Skip to content
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

i18n for Windows? #148

Closed
zvezdochiot opened this issue Jan 17, 2021 · 13 comments
Closed

i18n for Windows? #148

zvezdochiot opened this issue Jan 17, 2021 · 13 comments

Comments

@zvezdochiot
Copy link
Contributor

zvezdochiot commented Jan 17, 2021

UTF-8

When building under Windows, it is necessary to translate Russian localization files from UTF-8 to CP1251. Is it possible to somehow solve this problem?

See also: https://geodesist.ru/threads/geoeasy-3-0-3.70513/

@zsiki
Copy link
Owner

zsiki commented Jan 17, 2021

Using iconv (on Linux) you can convert to code page 1251. Change directory to the i18.

mv geo_easy.rus geo_easy.rus.utf8
iconv -f utf8 -t geo_easy.rus.utf8 > geo_easy.rus
mv com_easy.rus com_easy.rus.utf8
iconv -f utf8 -t com_easy.rus.utf8 > com_easy.rus

Please send me a notice if it solves the issue.

@zvezdochiot
Copy link
Contributor Author

zvezdochiot commented Jan 17, 2021

@zsiki say:

Using iconv (on Linux) you can convert to code page 1251.

This is a bad decision! This will fix localization under win, but ruin under linux!

May be use https://tcl.tk/man/tcl/TclCmd/encoding.htm . I just didn't understand how to get the system encoding.

@zsiki
Copy link
Owner

zsiki commented Jan 17, 2021

I just asked you to try it, if it solve the problem I will make a solution for it.
I DID NOT tell you this is the solution!
I have no Russian windows to test.

@zvezdochiot
Copy link
Contributor Author

Ok. I can do this in a separate branch. But I am not doing assemblies (freewrap). How can I test the result?

@zsiki
Copy link
Owner

zsiki commented Jan 18, 2021

If you have a Windows installation just replace the geo_easy.rus file in the i18 folder and restart the program.

@zvezdochiot
Copy link
Contributor Author

zvezdochiot commented Jan 18, 2021

Make new branch and commit: Geo-Linux-Calculations@561e22f

@zsiki say:

If you have a Windows installation just replace the geo_easy.rus file in the i18 folder and restart the program.

Test ok:
i18n-russian-cp1251
Good!

https://github.com/Geo-Linux-Calculations/GeoEasy/releases/tag/3.1.4-dev-cp1251

@XRolland
Copy link

XRolland commented Jan 18, 2021

Hi,

I'm following this issue because I asked myself which code page when I started french localization (which stays at a very early state today). I looked in the doc, but I didn't find any guideline about that (but I may have messed it).
Looking into Win package, I noticed that there was heterogeneous code page:

  • com_eazy.cze & geo_eazy.cze ->ANSI
  • com_eazy.eng & geo_eazy.eng UTF-8 but could be read as 1251 without problem
  • geo_eazy.es appear to be in UTF-8 but uses "uxxxx" to be read as 1251
  • geo_eazy.ger -> ANSI
  • com_eazy.hun & geo_eazy.hun ->ANSI
  • geo_eazy.rus-> UTF8, as said above.

Zoltan, could you, please help us in giving us some guidelines for character encoding in l10n?
Or maybe it could be just a header line in the l10n file as it'used to be in Python?
Thanks!

@zsiki
Copy link
Owner

zsiki commented Jan 18, 2021

@XRolland, I did not investigate much in this issue so far. Probably the best solution would be to maintain all language files in the same code page and convert it to the local one during installation or at the program start up. Please help me to find a good solution!
For Linux I suppose UTF-8 is OK for most of the languages (except Chinese, I guess). At the start up of the program the "HKEY_LOCAL_MACHINE\SYSTEM\CONTROLSET001\control\nls\language InstallLanguage" is queried from the registry on Windows. It returns some Windows specific code. There is a huge table of codes here: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c?redirectedfrom=MSDN.
I maintain an array langCodes in the geo_easy.msk file, but it won't work for all Windows versions and language variants.
@XRolland you can edit/translate message files using UTF-8, using iconv we can convert it to other code page later if necessary. As far as I know there are different code page for French Canadian, so it can be more complex.
I wish Windows used UTF-8!

@zsiki
Copy link
Owner

zsiki commented Jan 18, 2021

Searching for solution I realized there are more language settings on Windows beside install language:
https://stackoverflow.com/questions/1610337/how-can-i-find-the-current-windows-language-from-cmd

@zsiki
Copy link
Owner

zsiki commented Jan 18, 2021

Issue #75 was opened 2 years ago...

@zvezdochiot
Copy link
Contributor Author

@XRolland , if under win, then you can use https://notepad-plus-plus.org/ for transcoding.

@XRolland
Copy link

@zsiki I'm not a coder, isn't it better to use, if possible, UTF-8 for all l10n files? But I won't be able to help you to manage a correct display under Windows...

In fact, I stupidly thought that Windows was using UTF-8 since Seven! Crazy man...

@zvezdochiot Thanks for your suggestion. It's my default text editor! ;-)

@zsiki
Copy link
Owner

zsiki commented May 15, 2021

Source utf-8 encoded message with proc encsource from here:
https://wiki.tcl-lang.org/page/source+with+encoding

@zsiki zsiki closed this as completed in d943aad Jul 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants