-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Request] Split translations for some strings #97
Comments
I have made more strings translatable (like line no 286), |
I tried to separate translations for each string in a forked repo, but you were right, it is not possible. I will have to come up with translations for those strings that fit all occurrences. |
I've asked my friend who has experience making translatable apps. He said there is a way to do it: strings like "hight_humidity" and "high_pressure" in the code with translation in en.po to "High" in both places, and "Wysoka" and "Wysokie" in pl.po. |
Can you explain more clearly? |
I'll try :) Right now, the English version is hard-coded in the .py files, that's why there can be only one translation that covers all occurrences of these words. According to my friend, the way to work around that is to use separate strings for them. So in weatherData.py there would be something like
And then in the en.po:
and in pl.po
|
O I got you, so how are we going to deal with the non translated version? Like eng? |
I started reading gettext docs to try to answer your question without bothering my friend and found something that may be useful: defining string context in a po file using I have to read a bit more and try it out to see if it can help here, and then I will let you know. |
I've read more, and it should be simple, but I just can't get it to work in my Mousam fork. Using my non-existing Python skills I managed to create a working example though :) import gettext
gettext.bindtextdomain('gt', 'po')
gettext.textdomain('gt')
print("High as in high UV index:",gettext.pgettext("uvindex","High"))
print("High as in high humidity:",gettext.pgettext("humidity","High"))
print("High as in high polution:",gettext.pgettext("polution","High")) I got gt.pot file using #: GettextTest.py:5
msgctxt "uvindex"
msgid "High"
msgstr ""
#: GettextTest.py:6
msgctxt "humidity"
msgid "High"
msgstr ""
#: GettextTest.py:7
msgctxt "polution"
msgid "High"
msgstr "" After translating pl.po and creating .mo file with
But this is where my freshly aquired Python knowledge ends. |
That's nice , thnaks for all your efforts, i'll add these context wherever required. |
Sure , absolutely you can raise the pr. |
We don't use AM and PM in Polish and 24h time format is more natural for us than 12h. |
Ok, got it, but i wanted to know, what if I use 12h format in Polish, it should show AM , PM right? |
Nope, because AM and PM means nothing to us. If anything that would be "przed południem" and "po południu", but it isn't really used to format time. |
Oh, got it, I'll add support for 24h in comming days. Thanks for the clarification 😊 |
There are several strings used multiple times in different contexts. This works in English, but for languages that use noun declension (i.e. Polish) not so much.
Example:
"High" is used in mousam.py on line 276 (and also 286, but that's missing from mousam.pot), and in weatherData.py on lines 120, 133 and 142. In Polish translation, that should be "Max.", "Wysoki", "Wysoka" and "Wysokie".
The same with "Moderate", "Low" and "Extreme".
The text was updated successfully, but these errors were encountered: