How are translations organised

How are translations organised

by Jan van Leeuwen -
Number of replies: 35

Hi,

i am having trouble with 1 plugin where the translation is incomplete (quickmail).

I have loaded (renewed) the languagepack for german twice and it answers that it is already the latest version.

I have downloaded the language-package for german where this particular plugin has a language-file for quickmail, that is completely translated.

My testinstall (same server same version) shows the complete translation.


Question, how are translations organised?

I see in the languagepackage php-files with translated strings but i cannot find where these are stored in the directory-structure.


Can someone please give a hint where i can find information on how translations work in Moodle please?


Regards,

Jan

Average of ratings: -
In reply to Jan van Leeuwen

Re: How are translations organised

by Ken Task -
Picture of Particularly helpful Moodlers

What's in your moodledata directory?   Is there a 'lang' directory in moodledata?

Compare the two sites moodledata/lang directories.   A 'cheat' *might be* to copy moodledata/lang/ files from the one that works, to the moodledata/lang/ that doesn't.  Noitce I said *might be* ...  dunno that for sure... don't use german lang nor quickmail to know.

'SoS', Ken

In reply to Jan van Leeuwen

Re: How are translations organised

by Nurbek Tentiev -
You can customize language packs installed in your Moodle installation. Go to Site administration \ Language \ Language customisation, open needed langpack for editing, select the string you want to change and set a new value.
Average of ratings: Useful (1)
In reply to Jan van Leeuwen

Re: How are translations organised

by Jan van Leeuwen -
Hi,

i found the language-file in the data-directory - peculiar place.

I have cleared all caches.
Then renamed the file block_quickmail.php in zzz-block-quickmail.php
Then copied the completely translated block_quickmail.php from the test-install into data-directory/lang/de

Cleared the language-cache again.

I still have an incompletely translated file

That i do not understand . . .

Of cause i could translate the strings new but why i cannot copy into moodle an already translated file
and save me the work of going through every string again is unclear to me.

Any one have an idea what i oversaw?

Regards,
Jan
In reply to Jan van Leeuwen

Re: How are translations organised

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Moderator note: Jan, I am moving your discussion thread to the Languages forum where hopefully a translations expert will be able to help.

In reply to Jan van Leeuwen

Re: How are translations organised

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

i am having trouble with 1 plugin where the translation is incomplete (quickmail).

Right. That's unexpected. The Quickmail block defines total of 130 strings and they all have been translated into German as shown both at https://moodle.org/plugins/translations.php?plugin=block_quickmail and in AMOS at https://lang.moodle.org/local/amos/view.php?t=1617099786&v=l&l=de&c=block_quickmail&s&d

There is no need to move or rename any files. The only thing you as the admin need to do, is to install the German language pack and switch the current language into German.

If you still believe it does not work:

  1. What Moodle version do you use and what Quickmail block version do you have installed?
  2. Please describe or attach a screenshot of what exactly is not translated. Some plugins work in a way that they register some strings in the database using the current language at the moment when it was installed. If you were using English when the plugin was installed, some settings could be registered using the English strings.
  3. Is your currently selected language German? I.e. can you see the rest of Moodle UI in German?
In reply to David Mudrák

Re: How are translations organised

by Jan van Leeuwen -
Hi David,

"There is no need to move or rename any files. The only thing you as the admin need to do, is to install the German language pack and switch the current language into German."
The install always was in the german language we have 3.10.2+ now, before and after the last 7 updates it was all in the german language.

I re-installed the german languagepack but, as it already was the latest version that did not help.

There is no "believing" here, one can see that strings are not translated.

1 Moodle 3.10.2+ and
Quickmail
$plugin->version = 2019012401;
$plugin->requires = 2016052300;
$plugin->release = "v2.2.0";
$plugin->maturity = MATURITY_STABLE;
$plugin->component = 'block_quickmail';

I did find a language table in the database.

I guess for some obscure reason some strings ended up there in english.

Since i have an "identical" test-install on the same server where quickmail is completely in german i will have to use the "adjusting" and copy the tranlations in production, string by string.

Mixing up tranlations in files and in the database is something i have not yet found in any foss,
i am curious why this has been done that way.

Regards,
Jan
Average of ratings: Useful (1)
In reply to Jan van Leeuwen

Re: How are translations organised

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

I think it is misunderstanding. All the English strings and their translations are stored in files. What was the name of the table you found in the database? The only one I am aware of might be tool_customlang. But that one is not used for actual storage of translations. It is a temporary table used by the Language customisation tool.

There is no "believing" here, one can see that strings are not translated.

Do you have the file <your_moodledata>/lang/de/block_quickmail.php there?

In reply to David Mudrák

Re: How are translations organised

by Jan van Leeuwen -
The tables are:
mdl_tool_customlang : 66904 rows - seems these are the strings
mdl_tool_customlang_components : 515 rows - seems these are the names of the plugins the field "ID" is linked to field "componentid" in mdl_tool_customlang

I do have the file /lang/de/block_quickmail.php where all the strings are translated.

OnScreen in block Quickmail i See:

Quickmail

Compose Message
View Drafts
View Scheduled
View Sent Messages

That is english.

If I go to
Website-administration - Sprache -Sprachanpassung
choose "deutsch (de)" then "lokales Sprachpaket bearbeiten" then Komponenten "block_quickmail.php"
I see the text with a lot of "not-translated" parts.

Regards,
Jan
In reply to Jan van Leeuwen

Re: How are translations organised

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

Those tables and their content should play no role here. In fact, you don't need to use https://docs.moodle.org/en/Language_customisation at all - unless you actually really want to override some strings on your site.

Do you have something in <your_moodledata>/lang/de_local/ folder? Is block_quickmail.php there? Maybe you somehow accidentally overrode all German translations with English originals or so.

In reply to David Mudrák

Re: How are translations organised

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
In complement to David's point, and to be clear : if you didn't made customisation for this plugin, you should not have a block_quickmail.php file in /lang/de_local/ folder !

And if you have one, it takes precedence on the official language pack. So you should carefuly check what there is inside (or delete it).

HTH,
Séverin
Average of ratings: Useful (1)
In reply to Séverin Terrier

Re: How are translations organised

by Jan van Leeuwen -
Hi,
if i download the language package for german, i get a lot of PHP-files with all strings translated.
These files are found in /lang/de and are completely translated.

If look in Moodle's Database the 2 Tables mentioned seem to contain languagestrings as well but looking at my frontend the translation of quickmail is incomplete. Looking in the database-table "mdl_tool_customlang" there is a lot not translated.

My questions:

Why use 2 systems for translations?
How to disable using the database-tables instead of the php-files.

Regards,
Jan
In reply to Jan van Leeuwen

Re: How are translations organised

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Hi Jan,

It could be useful that you carefully read our messages and answer our questions. Or it will be difficult to help you.

Regards,
Séverin
Average of ratings: Useful (1)
In reply to Séverin Terrier

Re: How are translations organised

by Jan van Leeuwen -
Dear Severin,
i have made translations for several foss-projects from english to german and dutch. Know poedit and several webbased translationapps.
Usually translations are situated in files that are easy to copy.

Let me rephrase my questions:
if i have a moodle-install ment for german only what do i need besides the langugepackage?
What files are obligatory and where are they situated?
Where did the tables mdl_tool_customlang and mdl_tool_customlang_components come from and how do i get rid off these incomplete translations?

I just want moodle to be german only.

I have never customised any language-items till the complaint my main user made, that quickmail suddenly appeared partly in english.

I still hope that someone is able to explain the idea behind translations in both files and the database.

Regards,
Jan
In reply to Jan van Leeuwen

Re: How are translations organised

by Nurbek Tentiev -
As I understand from what you have written before, you are trying to update lang files in the moodledata folder. It will have only a temporary effect as the cron will be updating the language pack and thus those files as well.

I would say this is not the correct way to get language translation of this "quickmail" plugin. As per the official plugin page it has already all strings translated into German.

Another interesting thing is a compatibility with the version of Moodle. Your system is 3.10 but quickmail is officially supported up to 3.5 only (here). I must say, it does not necessarily mean that quickmail for 3.5 is not actually supported in 3.10. However this is what is worth to check.
Average of ratings: Useful (1)
In reply to Nurbek Tentiev

Re: How are translations organised

by Jan van Leeuwen -
Hi,

as i wrote before, i have
1 server Lamp-stack
2 moodle installs both version 3.10.2+ (1x production, 1 x test)
same plugins in both

Quickmail in test is all german
Quickmail in production suddenly partly in english.

I just want to know why and correct that.

Regards,
Jan
In reply to Jan van Leeuwen

Re: How are translations organised

by Nurbek Tentiev -

Did you check the "Language customization" section as I suggested several days ago?

I mean to check via web admin interface of Moodle, but neither in php files nor database tables. Find your plugin in the list, select it and click the "Show strings" button.

Do you have translations of all the strings there? 


In reply to Nurbek Tentiev

Re: How are translations organised

by Jan van Leeuwen -
Hi, Nurbek,

the answer is no.
As i assume that these are the tranlations in the database-tables because there is much more in the tables that is not translated.

I had a look at several php-files these are completely translated.

If i can force moodle to use the php-files only, i guess the problem is solved.

Regards,
Jan
In reply to Jan van Leeuwen

Re: How are translations organised

by Michael Milette -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Purge all cache. Moodle will then reload the language strings from its language files.

Check the German translations in AMOS. That is what feeds the language packs.

If you want to correct German translations, do it in AMOS and wait a few days. Not only will this help you but everyone else too.

This is my current understanding of how Moodle loads language strings for plugins/themes. The mechanics of language API may work differently but the result will be essentially the same:

  1. Loads strings from Moodle cache (probably the database table you found). This is rebuilt from step 2 to 6 when you Purge Moodle's cache or a language pack is intalled/updated.
  2. Loads English strings from step 3 to 5 first. These are the default strings if a string has not yet been translated. It is also why all plugins should be made available in English (en) first. It then repeats the process overwriting these with the desired root language versions of the strings (example: fr for French). Then it will repeat the process overwriting these with dialect/regional specific language strings (example: fr_ca for French - Canada) if required.
  3. Loads strings from pluginname/lang/xx/plugintype_pluginnane.php. This is generally English only and included by the developer.
  4. Loads strings from moodledata/lang/xx/plugintype_pluginname.php. This is the language pack strings which are generated by AMOS and updated by Moodle's Task Scheduler.
  5. Loads strings from moodledata/lang/xx_local/plugintype_pluginname.php. This are the strings modified using the Moodle language customization editor. If you want to bulk copy string customizations from one Moodle site to another. These are the files to copy. Be sure to purge cache afterwards.
  6. Writes resulting strings to Moodle's cache. Repeat for each installed language pack.

One the strings are loaded into cache, modifying PHP language files has no effect until the Moodle cache is purged.

I think about covers it. Hope it is not too confusing and you find this information useful.

Best regards,

Michael Milette

In reply to Michael Milette

Re: How are translations organised

by Jan van Leeuwen -
Thank you very much.

I will start purging all caches to see that information is refreshed.
So, if the files are the main source for the translations then the tables are used for the caching i guess.

That makes sense!

Regards,
Jan
In reply to Jan van Leeuwen

Re: How are translations organised

by Nurbek Tentiev -
Can you attach here 'block_quickmail.php' from the install where you are experiencing the problem: moodledata/lang/de/block_quickmail.php ?

I installed new instance of moodle 3.10.3 with DE langpack. Quickmail is working just fine. I will check your file on my system.
In reply to Nurbek Tentiev

Re: How are translations organised

by Jan van Leeuwen -
I appreciate your help but i have an install where the translation is OK.
Same server, same versions etc.

So as Michael stated it must be the cache.

Regards,
Jan
In reply to Jan van Leeuwen

Re: How are translations organised

by Nurbek Tentiev -
Of course, if you changed something manually in files, you need to purche the cache.
But I would recommend using web interface for updating translations as when you do it manually you can mess up a syntax. May be this is the case.

image.png
In reply to Jan van Leeuwen

Re: How are translations organised

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

I still hope that someone is able to explain the idea behind translations in both files and the database.

And I was trying to explain that you have misunderstood it. There is no "translations in both files and the database". Moodle takes strings from files only. Please stop looking into the database - those two tables you found are irrelevant.

Average of ratings: Useful (1)
In reply to David Mudrák

Re: How are translations organised

by Nurbek Tentiev -

>> stop looking into the database

👍

and looking at lang strings through web interface is much more convenient rather than in php files.

Do you know for sure that nothing relevant to language strings translations is saved in the database?  I had similar case with calendar. When I was editing string in file it had only temporary effect - the string was returning to its original default value after several days (because of cron??).

In reply to David Mudrák

Re: How are translations organised

by Jan van Leeuwen -
Thank for your help David,
I now understand this part that is important if the users are german only.

After all caches are purged i hope the problem is solved, i will notify.

Regards,
Jan
In reply to Jan van Leeuwen

Re: How are translations organised

by Jan van Leeuwen -
I just purged all caches.
website administration - dev - caches - purge all caches
also cleaned the browsercache

The page "Dashboard" still shows the texts for Quickmail in english.

I did not started to translate myself because the file "block_quickmail.php" already is completely translated.
I searched for a reason why i get english texts and could only find that there are english texts in the databasetables.

So my question remains:
How are translations, core and plugins, organised?

Before i started this thread i did search the internet and did not find an answer.
Probably i will have to search for a/the developerforum.

Regards,
Jan
In reply to Jan van Leeuwen

Re: How are translations organised

by Nurbek Tentiev -

Open the page where you have those "problematic" texts in both languages and compare. Can you post screenshots for DE and EN interface?

Are the texts completely similar?

Just to make sure that the texts come from Moodle but not from, for example, browser's translation 😀 Otherwise I don't know what could be a cause for such a strange behavior...


In reply to Nurbek Tentiev

Re: How are translations organised

by Jan van Leeuwen -
Hi,
i have no browser-translation active, as i visit sites in english, german and dutch this would be problematical for me.

Here are 2 screenshots, one where the language of the site is german and one where the language is english.

As you can see for yourself, the texts for quickmail are not in german.

Regards,
Jan
Attachment Screenshot_20210406_152818.png
Attachment Screenshot_20210406_153649.png
In reply to Jan van Leeuwen

Re: How are translations organised

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
Let me try a different approach.
There are two things you can do regard to languages: translation and customization. Neither of them is done in files. Database is only as helper to generate files

Translation:

Customization
  • On your local server
  • For if you are not happy for some reason with the default translation coming from Amos
  • Tool for doing that on yourhost/moodle/admin/tool/customlang/index.php
  • Generates files in a folder moodledata/lang/xx_local
  • Process on https://docs.moodle.org/310/en/Language_customisation

My first guess is that you have a moodledata/lang/de_local folder. This should not be there if you want to work with standard language pack.
My second guess would be that you have a moodle/blocks/quickmail/lang/de folder. This should absolutely not be there.

I hope that clears something up.

Kind regards
Koen
Average of ratings: Useful (3)
In reply to koen roggemans

Re: How are translations organised

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Superb thread to learn the Moodle language mechanism.

And got it: Guilty unless proven innocent.
:-\
In reply to Visvanath Ratnaweera

Re: How are translations organised

by Jan van Leeuwen -
Thanks for your helpfull reaction.
I do not think in terms of innocense or guilt, i have a little problem i would like to solve.

Moodle is a fantastic system but where people work, mistakes are made, if i am the cause of the mistake i would like to know and learn from my mistake.

Regards,
Jan
In reply to koen roggemans

Re: How are translations organised

by Jan van Leeuwen -
Hi Koen (another dutchman?)

i am sorry but:
https://amos.moodle.org/ is a dead link

Looked at the data:
moodledata/lang/de_local folder is not there
/blocks/quickmail/lang/de folder is not there

Thanks for the link:
AMOS, i had a look at that, it is for the translators - not how it works inside a moodle-install

I guess i slowly understand how it should work, but i have this little problem that i would like to solve.

Regards,
Jan
In reply to Jan van Leeuwen

Re: How are translations organised

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators

Sorry about the link - https://lang.moodle.org of course. Dutch speaking, from Belgium smile

Good that those 2 possible causes are ruled out.

  • not a local modification
  • not a problem with the module

As for the local modification: you do use de and not de_du, de_wp, de_com, ...? Otherwise you have to check the other de_xx_local folders of course.

Further investigation

  • I checked the language pack and verified that all quickmail strings are translated and German: OK
  • I checked the derived language packs (comm, kids, du, wp, ch) to verify that there are no strings for quickmail there: OK

So we are now sure that the problem is not on the end of the language pack. It must be a local problem.

From the thread I got that the strings are there in your language pack. So I can see only 2 reasons why they are not used: they are overwritten by English or the system can't read/find the German files. You are sure folders in lang are all readable and executable  for the webserver proces (e.g. 755) and the files are at least readable (e.g 644) ?

I'm very curious now because I honestly don't know where else to look. Going through the tread, there isn't much that isn't covered yet.


Average of ratings: Useful (1)
In reply to Jan van Leeuwen

Re: How are translations organised

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
If i understand correctly, it seems that in your "Kommentare" bloc, you also have the sentence "Showing 80 most popular tags" that is not translated...

So Quickmail seems not to be the only one impacted, and the problem is more general.

But if you have no moodledata/lang/de_local nor /blocks/quickmail/lang/de folder, and purging caches had no effect, i don't understand where the problem can come from...