Add new language strings to loginform

Add new language strings to loginform

by Norbert Süli -
Number of replies: 1

Dear community, 

i tryed to add two more language string tot he login site in the loginform.mustache

                       <p><a href="https://xy.z">{{#str}}forgottenst{{/str}}</a></p>

                       <p><a href="https://yx.z">{{#str}}forgottenc{{/str}}</a></p>

 

I added both of them to mdl_tool_customlang in database with en, and hu translations:

id            lang       componentid    stringid original master local       timemodified    timecustomized               outdated                modified

86383    en          1              forgottenc          Password change for colleagues               Password change for colleagues                Password change for colleagues               1612258778        1612258825        0             0

86384    hu          1              forgottenc          Password change for colleagues               Password change for colleagues                Jelszóváltoztatás kollégák számára          1612258872        1612258912        0             0

 

id            lang       componentid    stringid original master local       timemodified    timecustomized               outdated                modified

84449    en          1              forgottenst        Forgotten your password?          Password change for students   Password change for students       1601900193        1612276985        0              0

84447    hu          1              forgottenst        Forgotten your username or password?               Jelszóváltoztatás hallgatók számára               Jelszóváltoztatás hallgatók számára        1601900193        1612277157        0             0

 

I modified both of the string in the https://<moodlesite>/admin/tool/customlang/edit.php?lng=hu&p=0, and i found them in the hu_local and en_local folder/moodle.php, in the moodledata.

 

I cleared the cache too.

 

Still, the translations dont want to work(showing forgottenst and forgottenc). Can someone give me some advice about this? We want to have 3 different link for password change, with 2 of the links showing outside of the moodle. My current moodle version is 2020061503  .

 

Best regards,

Norbert Süli
Average of ratings: -
In reply to Norbert Süli

Re: Add new language strings to loginform

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You cannot add new language strings to the custom language packs that do not already exist in the English language pack built into the Moodle code.

If you have a custom theme, then I would suggest that you override the mustache template in your theme, add the language strings to theme/mytheme/lang/en/theme_mytheme.php and, in the mustache template, add: {{#str}}forgottenst, theme_mytheme{{/str}} (this is assuming your custom theme is called 'mytheme').

If you are not using a custom theme for the overrides and, instead, you are making changes to the core code, then you will need to add 'forgottenst' and 'forgottenc' to lang/en/moodle.php
Average of ratings: Useful (1)