NetTalk Central

Author Topic: NetTalk Maps Instruccion return (accents)  (Read 6578 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
NetTalk Maps Instruccion return (accents)
« on: July 10, 2020, 01:07:01 PM »
Besides... How to use ST to convert what cames from Here maps?

1,15600,897,Gire a la derecha en República del Paraguay. Siga por 897 m.
1,2700,148,Gire a la izquierda en Las Anémonas. Siga por 148 m.
1,11300,620,Gire a la derecha en Calle Namuncurá. Siga por 620 m.

Thanks
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetTalk Maps Instruccion return (accents)
« Reply #1 on: July 13, 2020, 09:19:52 PM »
I'm guessing the string is encoded as utf-8.
So move the string into a stringtheory object, then call ToAnsi on the object.
be sure to call
str.Start()
between different strings.

cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: NetTalk Maps Instruccion return (accents)
« Reply #2 on: July 14, 2020, 05:35:42 AM »
.ToAnsi does not work

Then and FWIW, this is how Im translating each instruction to Spanish:

        st.Start()
        st.SetValue(net.ManeuverQueue.InstructionText)
        st.ToAnsi()                                                             !<<<< Does nothing
        st.replace('Continue on','Siga por')
        st.replace('Your destination is on the','Su destino está sobre la')
        st.replace('Keep left','Mantenga la izquierda')
        st.replace('Keep right','Mantenga la derecha')
        st.replace('Take ramp','Tome la rampa')
        st.replace('Take the exit','Toma la salida')
        st.replace('Take the left exit','Tome la salida de la izquierda')
        st.replace('Take the right exit','Tome la salida de la derecha')
        st.replace('Take left ramp','Tome la rampa de la izquierda')
        st.replace('Take right ramp','Tome la rampa de la derecha')
        st.replace('Make a U-Turn at','Gire en U en')
        st.replace('exit from roundabout','salida de la rotonda')
        st.replace('Take left ramp','Tome la rampa de la izquierda')
        st.replace('Take right ramp','Tome la rampa de la derecha')
        st.replace('Go for','Siga por')
        st.replace('Turn ','Gire a la ')
        st.replace('Take the','Tome la ')
        st.replace('1st','1er')
        st.replace('2nd','2da')
        st.replace('3rd','3er')
        st.replace('4th','4ta')
        st.replace('5th','5ta')
        st.replace('Arrive at','Llegando a')
        st.replace('Head ','Siga ')
        st.replace('Depart from ','Salga desde ')
        st.replace(' keep',' mantenga')
        st.replace(' southwest',' al sudoeste')
        st.replace(' southeast',' al sudeste')
        st.replace(' left',' izquierda')
        st.replace(' right',' derecha')
        st.replace(' toward ',' hacia ')
        st.replace(' onto ',' en ')
        st.replace(' slightly',' algo a la')
        st.replace(' on ',' por ')
        st.replace('á','á')
        st.replace('é','é')
        st.replace('í','í')
        st.replace('ó','ó')
        st.replace('ú','ú')
        st.replace('ñ','ñ')
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetTalk Maps Instruccion return (accents)
« Reply #3 on: July 14, 2020, 06:52:44 PM »
this line;

>>   st.ToAnsi()                                                             !<<<< Does nothing

does nothing, because you are not using it correctly. Read the docs for ToAnsi and set the encoding and code page parameters correctly.

Of course you didn't ask the real question you wanted to ask - which was how to get the route instructions back in Spanish.
It turns out there's a parameter for that; so in 11.41 you can set this property

net.language = 'es-es'

a list of supported languages is here;
https://developer.here.com/documentation/routing/dev_guide/topics/resource-param-type-languages.html#languages

Cheers
Bruce



Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetTalk Maps Instruccion return (accents)
« Reply #4 on: July 14, 2020, 07:15:29 PM »
For 11.41 I've also made the conversion to Ansi automatic.
(you can control it by setting the net.encoding and net.codepage properties, but the defaults are ToAnsi, and it takes the codepage from your system{PROP:CharSet} as a default, so you likely don't need to do anything.)

Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: NetTalk Maps Instruccion return (accents)
« Reply #5 on: July 15, 2020, 03:55:03 AM »
Thanks, you are The man!
-----------
Regards
Alberto

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: NetTalk Maps Instruccion return (accents)
« Reply #6 on: November 03, 2020, 09:42:44 AM »
Related with this last automatic convertion (see your last response in this thread):

When you use net.GetLocation(Address) and the Address contains spanish characters it does not work because Address nust be utf8 enconded

Same thing for net.Getaddress(lat,lon), it returns the same as the instructions and need to be converted like the instructions.

Any chance of do this in the template?

Thanks
« Last Edit: November 03, 2020, 09:59:02 AM by michelis »
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetTalk Maps Instruccion return (accents)
« Reply #7 on: November 13, 2020, 05:57:18 AM »
done for next build as well.