Hi Max,
Thanks for keeping us on our toes :)
We will have to change the old style msgprints:
_("Hello %s. How are you?") % ("Max",)
to new style:
_("Hello {_user}. How are you?").format(_user="Max")
As per this stackoverflow conversation and my test on google translate, google does not replace {_user}
since it begins with an underscore which is not part of any langauge :D
It would be pretty easy to do this for server side code and will definitely enhance the multilingual translations.
For javascript strings, we might have to use Mustache instead of our repl()
method.
--
Note:
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CABK1YkNncEQbnkriZy3Ba--2oyW3w3ukPiv4fQS%3Do1VE-0L6AA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Max,
My tests were incomplete. Just checked that curlys do not translate well for some languages like German.
The other option would be to use Hello {0}
instead of Hello {_user}
. {0}, {1}
system seems to play well with google translate, but it wouldn’t be very maintainable in the long run.
Need to dig this further.
--
Note:
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/a5770185-aedb-4b7a-8ce8-7b00aff24b6c%40googlegroups.com.
Anand, would not it be better to treat only the automatic translations in a different way?
A simple function that before moving to the google translation service, replacing tags by indices can be created, and when you receive the translated text reinstates brands in the translated text?
eg:
import re
parse_in = re.compile("(\{\_[a-zA-Z]+\})+")
def prepare_to_translate(string):
.....
return (prepared, {0: "_person", 1: "_ask"})
def prepare_from_translate(string, replaces):
string.replace("{", "{{").replace("}", "}}").format(replaces)
def gtranslate(string, language):
marks = None
if parse_in.match(string):
string, marks = prepare_to_transalte(string)
translated = translate_api(string, language)
if marks:
translated = prepare_from_translate(translated, marks)
return translated
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/etPan.533d0123.1190cde7.189%40apdmacbook.local.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/a5770185-aedb-4b7a-8ce8-7b00aff24b6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Note:
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/etPan.533d0123.1190cde7.189%40apdmacbook.local.
Yes. Even I thought this should work. But for 3 languages: Hebrew, Urdu and Latin.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f699ae8d-783c-4826-9e9e-04e67b2d338b%40googlegroups.com.