Once again - you are doing a too simple example - translating from english to english isn't really a valid example. I understand that you would like to make it simpler - but the thing is that you never can know where the word is set in OTHER languages than from english to english. The reason I brought up this is because in various languages the wording will change - therefore your translation MIGHT work in english -> english but it would break other languages.
Also once more - the .po file format is NOT python specific - it is used by the gettext library and using python in there will simply not work. The gettext standard is used by many other languages as well (even wordpress uses it for translations).
If you really want to go down that route - you would need to write your own translation library - extract all of the translations, create an intermediate format for handling the words that are used in several places - use that file for translation, then create a new .po file from the results of that. And THEN run compilemessages.
Translations aren't simple - regardless of which way you do it....
Regards,
Andréas
Den lör 2 maj 2020 kl 21:07 skrev gqq nbig <gqqnb2005@gmail.com>:
I don't get why you are talking about this.--I understand the words may change order in another language, but I'm not talking about ordering.<h1>{% trans 'color' %}</h1>
<p>{% trans 'color has various emotional effects.' %}</p>
<p>{% trans 'Red color makes people feel angry.' %}</p>
<p>{% trans 'Blue color makes people feel said.' %}</p>Now I translate this America English to British English.msgid "color"msgstr "colour"Since I already translated color to colour, I want to refer this translation in other translations.msgid "color has various emotional effects."msgstr "{{ refer to the translated text of color }} has various emotional effects."msgid "Red color makes people feel angry."msgstr "Red {{ refer to the translated text of color }} makes people feel angry."In this msgstr, is it possible to refer to the string colour?In this way, in case later my boss says color should be translated to tint in en-UK, I only need to change one place.
在 2020年5月2日星期六 UTC-7上午11:44:41,Andréas Kühne写道:Hi,Your idea isn't that good. The problem is the following:_("My name is {name}").format(name='Andréas')This is a translation in a python context. So say that that translation gets translated into another language, where the name should come first:msgid "My name is {name}"msgstr "{name} other translated text"You never know what order the translations will be coming in, in various languages. So you should actually AVOID DRY in translations.... The more you can pinpoint a translatable string the better.Also - the .po files that are used for translation are a format that is specified OUTSIDE of python and django anyway :)Regards,AndréasDen lör 2 maj 2020 kl 00:39 skrev gqq nbig <gqqn...@gmail.com>:--
msgid "Tree free"msgstr "aa"
msgid "True free is good"msgstr "aa is good"
This po file has a key "Tree free", which I translated to "aa". There is another key "True free is good", which should be translated to "aa is good."Considering the Don't Repeat Yourself rule, can I refer the translation of "Tree free" in "True free is good".I'm looking for a syntax or sort of things that is likemsgid "True free is good"msgstr "{% trans 'Tree free' %} is good"
Can I refer to another translation in a translation? I'm fine with extending an internal class, how should I do it?
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a5a0b03a-eb4c-4699-ac69-5c1db9320805%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4732ad74-0266-4c0c-b938-33ea40c15627%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK4qSCcc4yHGB4%2Be4K9eNTUWF%2Bz7SPPf1y4Q3gZjTD2BuzZd9g%40mail.gmail.com.
No comments:
Post a Comment