languages.rst 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. ***************
  2. Languages
  3. ***************
  4. FusionPBX has multilingual capabilities. This will allow for different languages to be used in your FusionPBX installation. Languages can be set globally, per tenant and per user. In addition to your FusionPBX installation web interface, there are options to upload audio files for FreeSWITCH to use via command line.
  5. Fusionpbx Settings
  6. ^^^^^^^^^^^^^^^^^^^
  7. Global
  8. --------
  9. **Advanced > Default Settings**
  10. Setting the language from here will set the language for the entire FusionPBX installation.
  11. .. image:: ../_static/images/getting_started/fusionpbx_global_language1.png
  12. :scale: 60%
  13. Domain (Tenant)
  14. -------------------
  15. **Advanced > Domains** then click the plus at the bottom right and fill in the required fields.
  16. Setting the language from here will set the language for the entire domain (tenant) in your FusionPBX installation. This can override the Global language settings.
  17. .. image:: ../_static/images/getting_started/fusionpbx_domain_language2.png
  18. :scale: 60%
  19. User
  20. ------
  21. **Accounts > Users** then edit the user.
  22. Setting the language from here will set the language for this specific user and will override Global and Domain language settings.
  23. .. image:: ../_static/images/getting_started/fusionpbx_user_language3.png
  24. :scale: 60%
  25. FreeSWITCH Sound Files
  26. ^^^^^^^^^^^^^^^^^^^^^^^
  27. FreeSWITCH sound files location are dependent on operating system and installation method.
  28. **Package Install**
  29. -----------------------
  30. * Most if not all recent installations of FusionPBX are using packages for FreeSWITCH.
  31. * **File system location:**
  32. ::
  33. /usr/share/freeswitch/sounds/en/us/
  34. **Source Install**
  35. --------------------
  36. * Older installs, custom installs, or personal preference are using source compiled versions.
  37. * **File system location:**
  38. ::
  39. /usr/local/freeswitch/sounds/en/us/
  40. **Where to get language sounds**
  41. ----------------------------------
  42. * **Free:** https://freeswitch.org/stash/projects/FS/repos/freeswitch-sounds/browse
  43. app_languages.php
  44. ^^^^^^^^^^^^^^^^^^^
  45. **Guidelines**
  46. The words used in the text variable name
  47. * separated with a dash.
  48. * begin with a prefix
  49. * are lower case
  50. **Prefixes**
  51. * **title:** The title of the page
  52. * **header:** The header of the page
  53. * **description:** Information to describe the page or an item on the page
  54. * **button:** The label for the buttons
  55. * **confirm:** A message used to confirm and action like delete
  56. * **message:** The response after an action is taken
  57. * **label:** The label for items on the page
  58. * **option:** The options in an html select box
  59. **Languages**
  60. Each word, phrase, or sentence has the language declared with the 2 language code with s dash seperating the region. There is one difference the region is entirely in lower case. For additional information see the following.
  61. http://www.w3.org/International/articles/language-tags/
  62. http://www.iana.org/assignments/language-subtag-registry
  63. * en-us
  64. * es-mx
  65. * de-ch
  66. * de-at
  67. * fr-ca
  68. * fr-ch
  69. * pt-pt
  70. * pt-br
  71. **Example File**
  72. An excerpt from the app_languages.php for Conference Center.
  73. ::
  74. <?php
  75. $text['title-conference-center']['en-us'] = 'Conference Center';
  76. $text['title-conference-center']['pt-pt'] = '';
  77. $text['header-conference-center']['en-us'] = 'Conference Center';
  78. $text['header-conference-center']['pt-pt'] = '';
  79. $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.';
  80. $text['description-conference-center']['pt-pt'] = '';
  81. $text['label-name']['en-us'] = 'Name';
  82. $text['label-name']['pt-pt'] = '';
  83. $text['label-extension']['en-us'] = 'Extension';
  84. $text['label-extension']['pt-pt'] = '';
  85. $text['label-delete']['en-us'] = 'Delete';
  86. $text['label-delete']['pt-pt'] = '';
  87. $text['label-edit']['en-us'] = 'Edit';
  88. $text['label-edit']['pt-pt'] = '';
  89. $text['button-view']['en-us'] = 'View';
  90. $text['button-view']['pt-pt'] = '';
  91. $text['button-back']['en-us'] = 'Back';
  92. $text['button-back']['pt-pt'] = 'Voltar';
  93. $text['confirm-update']['en-us'] = 'Update Complete';
  94. $text['confirm-update']['pt-pt'] = 'Actualização Completa';
  95. $text['confirm-delete']['en-us'] = 'Do you really want to delete this?';
  96. $text['confirm-delete']['pt-pt'] = '';
  97. $text['button-add']['en-us'] = 'Add';
  98. $text['button-add']['pt-pt'] = '';
  99. $text['button-save']['en-us'] = 'Save';
  100. $text['button-save']['pt-pt'] = 'Guardar';
  101. ?>
  102. To use inside the code on each page that displays text. Place the following code at the top just after the permision_exists
  103. ::
  104. //add multi-lingual support
  105. require_once "app_languages.php";
  106. foreach($text as $key => $value) {
  107. $text[$key] = $value[$_SESSION['domain']['language']['code']];
  108. }
  109. To place a word, phrase or sentence it would be used in the code like the following example.
  110. ::
  111. echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['title-conference-centers']."</b></td>\n";
  112. An additional example.
  113. ::
  114. echo " <tr>\n";
  115. echo " <td align='left' colspan='2'>\n";
  116. echo " ".$text['description-conference-centers']."\n";
  117. echo " </td>\n";
  118. echo " </tr>\n";
  119. echo "</table>\n";