• Resolved fussballminister

    (@fussballminister)


    Hello,

    I already searched the forum topics but found no solution.

    I use the leaguemanager plugin for a german soccer league an would like to switch the “o.P.|on penalty” and “AET|after extra time” in the matches plan.

    Configuration:
    My WordPress (4.0.1) is configured to Language “de_DE”.
    The German language file “leaguemanager-soccer-de_DE.mo”, which i placed in the languages folder is loaded correctly because at some places the translation works. E.g. in the header of the matches table is written “Spiel” instead of “Match” and “Ergebnis” instead of “Score”.

    In the language file I also wrote down definitions for “on penalty”, which is “n.E.” in german. But this is not loaded.

    Can anyone give me an hint how to solve this?

    I suppose the reason could be that the “o.P|on penalty” is hardcoded somewhere? or it is calculated by a function that doesn’t support the use of the language files yet?

    (I also would agree to some ‘dirty hacks’ ?? E.g. if anyone could tell me, where i can hardcode the german meaning beacuse I won’t need other languages later. But I didn’t found the place where the on penalty / after extra time is calculated.)

    https://www.ads-software.com/plugins/leaguemanager/

Viewing 1 replies (of 1 total)
  • Thread Starter fussballminister

    (@fussballminister)

    OK, i found the cause of the error ??

    There were two things:

    a. For all the words that couldn’t be translated, there were two alternatives given in the .po file.

    e.g. for “Tie”, in the file was written “T|Tie” ans for “Win” it was “W|Win”. As it was so in the original language files of the league manager, I thought this is according to the normal syntax. But after removing the “|” and splitting the entries into two, everything works ?? I am not sure if this was not the right syntax or perhaps the compiler, that I used to compile the .po file to a .mo file was wrong.
    I used the online compiler at https://po2mo.net/

    b. after solving the issue of a. the “on penalty” thing wasn’t transpated anyway :/ so I looked further and found that in some places of the league manager, instead of the php function _e, the function _x is used. But it is used in wrong way, as the _x function rewuires an additional parameter for context. This additional parameter was’t used at any place. And it was also not defined in the .po files ?? so of course the php processor couldn’t decite, which translation to use and therfore did notzing in this cases.

    SOLUTION for BOTH points:

    a.

    instead of

    msgid "AET|after extra time"
    msgstr "n.V.| nach Verl?ngerung"

    better use

    msgid "AET"
    msgstr "n.V."
    
    msgid "after extra time"
    msgstr "nach Verl?ngerung"

    b.
    if you need to use the _x function instead of _e, than you have to define the context in the .po file as follows:

    msgctxt "mycontext"
    msgid "AET"
    msgstr "n.V."

    and you have to provide the context as second parameter of the _x call:
    e.g. in line 332 of the shortcodes.php instead of:
    _x( 'AET', 'leaguemanager' )
    use
    _x( 'AET', 'mycontext', 'leaguemanager' )

    One thing, that i didn’t find out, is why _e is not working at this place. Therefore I did the workaround with ‘mycontext’, although, I don’t really need any context differentiation there.

Viewing 1 replies (of 1 total)
  • The topic ‘Language file does not work’ is closed to new replies.