language translation "patch" code does not work in

Please report bugs here!

Moderator: Thorsten

Post Reply
Lidio
Posts: 25
Joined: Mon Dec 10, 2007 9:26 pm

language translation "patch" code does not work in

Post by Lidio »

For 2.0.4 there is code to translate the log entries from German to specific languages. The code

Code: Select all

        $text = str_replace("Loginerror", $PMF_LANG["ad_log_lger"], $logging_value['text']);
        $text = str_replace("Session expired", $PMF_LANG["ad_log_sess"], $logging_value['text']);
        $text = str_replace("Useredit, ", $PMF_LANG["ad_log_edit"], $logging_value['text']);
        $text = str_replace("Beitragcreatesave", $PMF_LANG["ad_log_crsa"], $logging_value['text']);
        $text = str_replace("Beitragcreate", $PMF_LANG["ad_log_crea"], $logging_value['text']);
        $text = str_replace("Usersave, ", $PMF_LANG["ad_log_ussa"], $logging_value['text']);
        $text = str_replace("Userdel, ", $PMF_LANG["ad_log_usde"], $logging_value['text']);
        $text = str_replace("Beitragedit, ", $PMF_LANG["ad_log_beed"], $logging_value['text']);
        $text = str_replace("Beitragdel, ", $PMF_LANG["ad_log_bede"], $logging_value['text']);
        print $text;
could not possible work since any of the string replace would be reset to the default value of the text in $logging_value['text'] by the next str_replace statement.

Here is a "dirty" work-around

Code: Select all

        $text = $logging_value['text'];
        $text = str_replace("Loginerror", $PMF_LANG["ad_log_lger"], $text);
        $text = str_replace("Session expired", $PMF_LANG["ad_log_sess"], $text);
        $text = str_replace("Useredit, ", $PMF_LANG["ad_log_edit"], $text);
        $text = str_replace("Beitragcreatesave", $PMF_LANG["ad_log_crsa"], $text);
        $text = str_replace("Beitragcreate", $PMF_LANG["ad_log_crea"], $text);
        $text = str_replace("Usersave, ", $PMF_LANG["ad_log_ussa"], $text);
        $text = str_replace("Userdel, ", $PMF_LANG["ad_log_usde"], $text);
        $text = str_replace("Beitragedit, ", $PMF_LANG["ad_log_beed"], $text);
        $text = str_replace("Beitragdel, ", $PMF_LANG["ad_log_bede"], $text);
        print $text;
Also the translation for "Beitragsave" is missing. One could add

Code: Select all

        $text = str_replace("Beitragsave", "Save", $text);
A more elegant solution is to perform those translations at the calls to adminlog("Beitragcreatesave") with like adminlog( $PMF_LANG["ad_log_crsa"]).

Lidio.
Thorsten
Posts: 15815
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

thanks for the hint, it's fixed in 2.0.5.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply