Difference between revisions of "App languages.php"
From FusionPBX
(Created page with "The app_languages.php is an array of all the words, phrases and sentences used in the project. Each item begins with a prefix title- the title of the page description- info...") |
|||
Line 1: | Line 1: | ||
The app_languages.php is an array of all the words, phrases and sentences used in the project. | The app_languages.php is an array of all the words, phrases and sentences used in the project. | ||
− | + | ===Guidelines=== | |
− | + | The words used in the text variable name | |
− | + | * separated with a dash. | |
− | + | * begin with a prefix | |
− | + | * are lower case | |
− | |||
− | Example app_languages.php | + | ===Prefixes=== |
+ | * '''title''' - the title of the page | ||
+ | * '''description''' - information to describe the page or an item on the page | ||
+ | * '''button''' - the label for the buttons | ||
+ | * '''confirm''' - a message used to confirm and action like delete | ||
+ | * '''label''' - the label for items on the page | ||
+ | |||
+ | |||
+ | ===Example File=== | ||
+ | An excerpt from the app_languages.php for Conference Center. | ||
<?php | <?php | ||
Line 50: | Line 58: | ||
?> | ?> | ||
+ | |||
+ | To use inside the code on each page that displays text. Place the following code at the top just after the permision_exists | ||
+ | |||
+ | //add multi-lingual support | ||
+ | require_once "app_languages.php"; | ||
+ | foreach($text as $key => $value) { | ||
+ | $text[$key] = $value[$_SESSION['domain']['language']['code']]; | ||
+ | } | ||
+ | |||
+ | To place a word, phrase or sentence it would be used in the code like the following examples. | ||
+ | |||
+ | echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['title-conference-centers']."</b></td>\n"; | ||
+ | |||
+ | echo " <tr>\n"; | ||
+ | echo " <td align='left' colspan='2'>\n"; | ||
+ | echo " ".$text['description-conference-centers']."\n"; | ||
+ | echo " </td>\n"; | ||
+ | echo " </tr>\n"; | ||
+ | echo "</table>\n"; |
Revision as of 18:11, 23 November 2012
The app_languages.php is an array of all the words, phrases and sentences used in the project.
Guidelines
The words used in the text variable name
- separated with a dash.
- begin with a prefix
- are lower case
Prefixes
- title - the title of the page
- description - information to describe the page or an item on the page
- button - the label for the buttons
- confirm - a message used to confirm and action like delete
- label - the label for items on the page
Example File
An excerpt from the app_languages.php for Conference Center.
<?php $text['title-conference-center']['en-us'] = 'Conference Center'; $text['title-conference-center']['pt-pt'] = ; $text['description-conference-center']['en-us'] = 'Conference Center is used to setup one or more conference rooms with a name, extension number, a required pin number length, and a description.'; $text['description-conference-center']['pt-pt'] = ; $text['label-name']['en-us'] = 'Name'; $text['label-name']['pt-pt'] = ; $text['label-extension']['en-us'] = 'Extension'; $text['label-extension']['pt-pt'] = ; $text['label-delete']['en-us'] = 'Delete'; $text['label-delete']['pt-pt'] = ; $text['label-edit']['en-us'] = 'Edit'; $text['label-edit']['pt-pt'] = ; $text['button-view']['en-us'] = 'View'; $text['button-view']['pt-pt'] = ; $text['button-back']['en-us'] = 'Back'; $text['button-back']['pt-pt'] = 'Voltar'; $text['confirm-update']['en-us'] = 'Update Complete'; $text['confirm-update']['pt-pt'] = 'Actualização Completa'; $text['confirm-delete']['en-us'] = 'Do you really want to delete this?'; $text['confirm-delete']['pt-pt'] = ; $text['button-add']['en-us'] = 'Add'; $text['button-add']['pt-pt'] = ; $text['button-save']['en-us'] = 'Save'; $text['button-save']['pt-pt'] = 'Guardar'; ?>
To use inside the code on each page that displays text. Place the following code at the top just after the permision_exists
//add multi-lingual support require_once "app_languages.php"; foreach($text as $key => $value) { $text[$key] = $value[$_SESSION['domain']['language']['code']]; }
To place a word, phrase or sentence it would be used in the code like the following examples.
echo "<td align='left' width='30%' nowrap='nowrap'>".$text['title-conference-centers']."</td>\n";
echo " <tr>\n"; echo " <td align='left' colspan='2'>\n"; echo " ".$text['description-conference-centers']."\n"; echo " </td>\n"; echo " </tr>\n"; echo "</table>\n";