web-money-manager-ex icon indicating copy to clipboard operation
web-money-manager-ex copied to clipboard

Website translation with php array files

Open lucaritossa opened this issue 7 months ago • 0 comments

The website has been revised moving all relevant english text into specific file /languages/en.php. Italian translation has been prepared into /languages/it.php file.

These files contain the $lang["key"] array with all text translated.

The usage is simple, for example the _btn_back.php changed from

<a href="landing.php" class="btn btn-lg btn-primary btn-block">Return to menu</a>

to

<a href="landing.php" class="btn btn-lg btn-primary btn-block"><?php echo $lang["return_to_menu"] ?></a>

/languages/en.php contains

$lang["return_to_menu"] = "Return to menu";

/languages/it.php contains

$lang["return_to_menu"] = "Ritorna al menu";

New "Language" setting is available in Settings page, currently with "en" and "it" values.

image

After saved the settings you will see automatically the website translated to the selected language.

There is only 1 known limit on this solution: the english text defined into javascript files can't be easly translated because ot the client-side nature.

To translate other languages follow these steps:

  1. Copy the en.php file and paste it with the name of the language you want to translate (ie: fr.php, de.php)
  2. Edit the copied file and translate all text into the target language.
  3. Edit the functions_design.php and add the new language into $AvailableLanguages array

I waited 1 month of personal testing before to create this PR and haven't found any issues.

This solve issue #25 I didn't change the $app_version in configuration_system.php. I propose 2.0.0 or at least 1.3.0.

lucaritossa avatar Nov 29 '23 17:11 lucaritossa