Community
OpenEnergyMonitor

OpenEnergyMonitor Community

How install Russian language?

Hi, have a nice day.

I have EmonCMS, set to Synology NAS, linux.
Tell me please, how can I add support for the Russian language?

Thankyou.

I think the correct method is using Poedit to create the translation files.

There are locale directories in each Module directory of emoncms eg emoncms/Modules/admin/locale/

For examples, the 2 most recent language additions were Estonian and German.

There is also an out of date guide to using gettext on Ubuntu for emoncms that may help,

This is how language support is installed on emonPi pre built SD card (emonSD-03-May16):

Since I have little knowledge of Linux, I tried this way:
copy and rename the folder en_EN in ru_RU from the directory /emoncms/Modules/admin/locale
<img
Then I made the following changes to the files and translate a few lines for administrator module page.

On the page on my profile have a choice of the Russian language, I chose it up and save.

But on the Admin page (for which I have translated a few lines), nothing has changed.

Then, I make changes in the locale file /emoncms/locale.php

Then restart the server, but still in the interface in English. How do I get the Russian language?

You could try changing the line “case 'nl' : $lang='ru_RU' : break;” to “case 'ru' : $lang='ru_RU' : break;”, but I’m not sure your approach is going to work, I can’t say it definitly won’t so it will be nice if it does.

The files you are trying to replicate are created using Poedit which is actually, primarily a free windows program that you can download from here, once you create those files you just need to put them in place.

When you’ve cracked it, please submit a PR on github for the benefit of other Russian speaking users of emoncms.

I tried to change the line

“case ‘nl’ : $lang=‘ru_RU’ : break;”
to
“case ‘ru’ : $lang=‘ru_RU’ : break;” - nothing happened.

And how to use Poedit, properly create and translate language files?

I have never used it myself, I am just aware that’s how at least some of the previous translations have been done.

I would suggest you do a net search for a quick tutorial in Poedit, perhaps even in russian if that’s easier for you.

Also take a look at this “Loco” online editor, it looks very simple to use, although I cannot comment on whether it’s suitable/compatible etc. But worth 5mins to give it a spin.

Looking at the “gettext wikipedia” the “.mo” files are “binary .mo (Machine Object) files” so that explains the need for an editor utility and why just editing the bits you can read does not work, you must use a utility to create the “binary machine code” in the “.mo” file from the “.po” file.

So it you have already prepared a “messages.po” file for ru_RU, you could just drag and drop it to Loco’s online editor, check it through and save the files locally, the new binary in “messages.mo” should (in theory) then be in russian, I have my fingers crossed for you.

Hi.
Thanks for the help with the program Poedit.
I was able to translate almost all modules! (/admin, /dashboard, /feed, /input, /shedule, /user; left a /vis.). But there was some message in my account that did not exist before:

Notice: Undefined index: ru-RU in /volume1/web/emoncms/Modules/user/profile/profile.php on line 36

What could it be?

@Tehnoinstyle_Aleksey: how were you able to activate your Russian translation? I’m trying to translate to Hungarian, have already done it for the Admin locale, but after selecting hu_HU I still just see the English text in the admin page. I’ve installed the hu_HU.utf-8 locale on the Pi and gettext is also installed (by default).

EDIT: I found the problem, it was caused by an improperly named message file…

Shouldn’t that be “ru_RU” ? (underscore not dash)

Yes, I made a mistake in writing ru_RU. Thank you.
Tomorrow i will translate the remaining module. How then submit a PR on github for the benefit of other Russian speaking users of emoncms?

You can “branch” the emoncms repo to your own github account and then “clone” your branch to your workstation/PC add the files/changes, “commit” the changes locally then sync the changes with your online account. From there you can create a “pull request” in a couple of clicks. You should create a pull request on the “Master” branch of emoncms not “stable”.

Hi.
Do not want to completely display of the text in Russian.
I as a basis for the translation took the file of the French language (the largest file size). I translated all installed modules, and even by default added to ru_RU locale file. All the same part of the text in English. Some modules entirely in Russian, some are not.

Where did I do wrong?

I’m guessing the previous translations were incomplete or in the case of some, if the string has been changed in development without the messages.po & messages.mo being updated then gettext will no longer recognize the new text and translate it. There was a big overhaul of emoncms from v8.4 to v9+ and for example the French “locale” predates that by about 3years.
Only the Estonian has been done recently, and @nchaveiro has updated the Spanish whilst doing the rework, anything else could be out of date and need tweaking.

Try using the “developer tools” of your browser to identify the origin of each untranslated item, each untranslated text string must have a "msgid " and “msgstr” in the correct Module’s messages.po before the messages.mo is created.

If you are using the online “Loco” utility you can just add the new entries with the translations directly.

“Apps” and “graphs” are separate Modules that do not appear to have the “locale” folder (dashboard does), whether you can just add them and it will work or not I have no idea, but it’s worth a try.

When/if you decide to contribute the translation via Github, each separate Module eg app, dashboard and graph will need a separate PR.