-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
chore: Add support for UA language translation. #4415
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UA fonts are different than RU, they have different subsets of Cyrillic symbols.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate further on this? Any idea what the range is if it's different? Are wrong characters being shown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kyiv - по цій транслітерації буде коректно?
Hi, Thanks for your work. Last activity in this PR was 3 weeks ago, so let me know if anything is needed for merging the initial version. Thanks. |
If you can proof the translation that's been provided, that would be a great start. Also, your thoughts on this comment? #4415 (comment) |
How should we do it technically? In this PR or after it's merged?
Ukrainian alphabet differs from Russian, I can second it. |
For you, it's probably easier after this PR is merged (since you'll then be able to do a PR with any changes). At this point, I think it's more just a matter of ensuring there is nothing major that needs changing before merge - like inappropriate words/phrases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PNGs seem to have only Russian alphabet letters, not the Ukrainian ones. Not sure how it impacts the UI and what's the use of the files.
L'г', L'д', L'е', L'ж', L'з', L'и', L'й', | ||
L'к', L'л', L'м', L'н', L'о', L'п', L'р', | ||
L'с', L'т', L'у', L'ф', L'х', L'ц', L'ч', | ||
L'ш', L'щ', L'ъ', L'ы', L'ь', L'э', L'ю', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the charset looks like is copy-paste from Russian.
- It does not have Ukrainian-specific letters Ґ, ґ, Є, є, І, і, Ї, ї and
- has some of the extra Russian letters, which are not used in Ukrainian.
And there is also an apostrophe - ' , which is probably the same as in latin.
https://en.wikipedia.org/wiki/Ukrainian_alphabet
Please correct it.
You need to draw your own Ukrainian fonts. This is necessary to display the signs on a black-and-white screen. |
@philmoz, I'm not sure I understand the end-to-end flow involving those PNGs - are PNGs generated somehow from the fonts or prepared manually? |
Have a look at radio/src/fonts/lvgl/make_fonts.sh and more importantly radio/src/fonts/lvgl/get_char_cyrillic.py (which are both part of this PR). |
For colour radios all the font handling is automatic as pfeerick mentioned. For B&W I believe it has to be done manually. The _utf8_lut array in utf8.cpp needs to be populated with the unicode characters you want to be available for display and then the font_ua_XX.png images need to be edited to contain the corresponding symbols. There are two sets of font images for B&W - one in the 'sqt5' folder and one in the 'std' folder. |
Thanks @pfeerick .
The full alphabet is The output of python3 get_char_cyrillic.py ../../translations/ua.h is (Ґ and ґ are missing):
There are some typos, some items left to be clarified in the context, but it should be safe to commit and do the QA.
PS: Sorry for the noobish questions, this is my first day in EdgeTX repo. Have been a happy user of the English version on my radiomaster. |
Most likely this file needs extending for the other B&W fonts... https://github.com/EdgeTX/edgetx/blob/main/radio/util/font2png.py edit: btw, path to the utf8.cpp file mentioned above is |
your PNGs should be the same as the Ukrainian alphabet. |
chars_ua = u"""АБВГҐДЕЄЖЗИІЇЙКЛМНОПРСТУФХЦЧШЩЬЮЯабвгґдеєжзиіїйклмнопрстуфхцчшщьюя""" |
You don't need to worry about this. The python script is extracting just the characters that are actually used in the translation file. So the missing ones are not a problem because they are not currently needed. |
Take my PNGs as a sample. Add the necessary characters, remove unnecessary ones. They look good on a black and white screen. |
I'm not a developer, sorry. I can modify something, but there is little probabilty that it will work fine. Especially with the pieces like font2png.py, where god only knows what parameters should be used: which font, size etc. I tried - and it differs greatly from what @kobakirill has done for Russian. diff --git a/radio/util/font2png.py b/radio/util/font2png.py COUNT_EXTRA_CHARS = 21 chars_extra = u"".join([chr(1+i) for i in range(COUNT_EXTRA_CHARS)]) def createFontBitmap(filename, fontname, fontsize, fontoffset, foreground, background, coordsfile=True): So it will be definitely tough for me to create my own pull request. But I can help with the language part here, because I know Ukrainian and I'm not afraid to read the code. Hope it clarifies my skill level. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a long review, but hopefully it would be helpful to improve the overall quality of the translation. Looking forward to see some changes. 😄
Do we care that Ukranian is using the country code (UA) instead of the language code (uk)? |
At the present time, the colorlcd translations should be in a somewhat usable state for colorlcd radios, but B&W will not be (until at least the font graphics and mapping is resolved. I would propose at this point to merge this as it is, so there is the start of UA support present in 2.10 and (like with everything else) it will get improved on with adoption and time. |
@pfeerick and @philmoz, are we sure that 'ua' are the right identifyer, in betaflight we use 'uk' and ISO Language Code Table from http://www.lingoes.net/en/translator/langcode.htm say "uk-UA" (compare to Danish 'da' / 'da-DK') |
For the present time, yes. Only two letters are currently used, and "uk" probably isn't as intelligible. As is alreadly noted in code, we are NOT currently following any of the ISO conventions at present in the references in Companion or firmware. But it is documented as a TODO item ;) In other words, until we move all languages over to something like ISO 3166 (country code) and ISO639 (locale code) pair, this is correct. |
Initial support for UA.
Not sure what else may be needed for Companion.
edit(pfeerick): To prevent any confusion (as it was not clearly pointed out), the translation included in this PR was not provided by the PR author, but an UA native speaker.