Translation Strings Status

68 views
Skip to first unread message

Maxwell Morais

unread,
Apr 1, 2014, 9:26:01 PM4/1/14
to erpnext-dev...@googlegroups.com, Rushabh Mehta
Hi, Rushabh, how are you?

Rushabh, a long time ago, I and you had started a discussion on Github about the condition of the translation strings on frappe (wnframework) and ERPNext projects.

We had reached an agreement in which the translation strings need for standardization, mainly due to the problems of interpolation and the addition of strings, because in other languages it ​​can not have agreed with the English language. 

In this regard, as we are? Any suggestions? Help?

--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3

Anand Doshi

unread,
Apr 1, 2014, 11:35:44 PM4/1/14
to Maxwell Morais, erpnext-dev...@googlegroups.com, pra...@erpnext.com, Nabin Hait, Rushabh Mehta

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.


Thanks,
Anand Doshi.
--
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.

rushabh

unread,
Apr 3, 2014, 1:41:35 AM4/3/14
to erpnext-dev...@googlegroups.com, Rushabh Mehta
Max,

If you have good suggestions, please go ahead and send a PR!

I think the backend system is quite good now, (to memcache everything) - the way we define strings surely needs to be improved.

best,
Rushabh

Anand Doshi

unread,
Apr 3, 2014, 2:35:15 AM4/3/14
to rushabh, erpnext-dev...@googlegroups.com, Rushabh Mehta

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.


Thanks,
Anand Doshi.
--
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.

Maxwell Morais

unread,
Apr 3, 2014, 9:55:20 AM4/3/14
to erpnext-dev...@googlegroups.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



For more options, visit https://groups.google.com/d/optout.

Syed Qadeer

unread,
Apr 5, 2014, 5:07:56 AM4/5/14
to erpnext-dev...@googlegroups.com
Indeed, thats a very good solution, converting the string before it is send to the google translate, and convert the strings back after the translation.

with this we can acheive the better translations by merging the strings into one string ,rather than doing the concatenations.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

--
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.

Anand Doshi

unread,
Apr 6, 2014, 3:13:07 AM4/6/14
to Syed Qadeer, erpnext-dev...@googlegroups.com

Yes. Even I thought this should work. But for 3 languages: Hebrew, Urdu and Latin.


Thanks,
Anand Doshi.
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.
Reply all
Reply to author
Forward
0 new messages