User Tools

Site Tools


ru:plugins:i18n

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
ru:plugins:i18n [2013/10/09 11:20]
Arkady [Фронтенд]
ru:plugins:i18n [2013/10/09 11:26]
Arkady [Multi-language Front-end]
Line 101: Line 101:
 ===== Multi-language Front-end ===== ===== Multi-language Front-end =====
  
-Some internet sites implemented with GetSimple ​support multiple languagesThe language is determined from the user's preferences ​(his operating system language resp. the browser languageand he might be allowed to switch between the supported languages.+На некоторых интернет-сайтах,​ созданных с помощью ​GetSimple, реализована поддержка нескольких языковЯзык сайта определяется на основе предпочтений пользователя ​(язык операционной системы,​ язык браузера), посетитель имеет возможность переключаться с одного языка на другой.
  
-As multi-language sites are not supported natively by GetSimple, there currently exists one plugin, ​[[http://​get-simple.info/​extend/​plugin/​i18n/​69/​|I18N]].+Создание и управление многоязычными сайтами не поддерживаются ядром ​GetSimple. В настоящее время для решения этой ​ задачи существует единственный плагин ​[[http://​get-simple.info/​extend/​plugin/​i18n/​69/​|I18N]]. ​ 
  
-If your plugin should support multi-language sites using the I18N pluginyou must load the texts **only after the I18N initialization** (in the pretemplate ​hook- in your function(s) that output text on the front endwith+Если ваш плагин должен поддерживать мультиязычные сайты с использованием плагина ​I18N, тексты из языковых фалов вашего плагина  ​**должны загружаются только после инициализации ​I18N** (это происходит в хуке ​pretemplate), ​с помощью следующего кода:
  
 <​code>​ <​code>​
 global $LANG; global $LANG;
 if (function_exists('​i18n_load_texts'​)) { if (function_exists('​i18n_load_texts'​)) {
-  i18n_load_texts('​my_plugin');+  i18n_load_texts('​мой_плагин');
 } else {  ​ } else {  ​
-  i18n_merge('​my_plugin', substr($LANG,​0,​2)) || i18n_merge('​my_plugin', '​en'​);​+  i18n_merge('​мой_плагин', substr($LANG,​0,​2)) || i18n_merge('​мой_плагин', '​en'​);​
 } }
 </​code>​ </​code>​
  
-If you need back end template texts directly when loading the pluginyou need to check, if the plugin is loaded in the backend:+Если при загрузке плагина в административную панель вам сразу требуются языковые строки - необходима проверказагружен ли плагин в бэкенде.
  
 <​code>​ <​code>​
 if (basename($_SERVER['​PHP_SELF'​]) != '​index.php'​) { // back end only - or do you know a better condition? if (basename($_SERVER['​PHP_SELF'​]) != '​index.php'​) { // back end only - or do you know a better condition?
-  i18n_merge('​my_plugin', substr($LANG,​0,​2)) || i18n_merge('​my_plugin', '​en'​);​+  i18n_merge('​мой_плагин', substr($LANG,​0,​2)) || i18n_merge('​мой_плагин', '​en'​);​
 } }
-add_action('​plugins-sidebar',​ '​createSideMenu',​ array($thisfile,​ i18n_r('​my_plugin/​CONFIGURE'​))); ​+add_action('​plugins-sidebar',​ '​createSideMenu',​ array($thisfile,​ i18n_r('​мой_плагин/​CONFIGURE'​))); ​
 </​code>​ </​code>​
  
-This code will work (with GetSimple 3.0+), ​whether the I18N plugin is present or not.+Этот код будет работать ​(с GetSimple 3.0+) вне зависимости от тогоустановлен ли в системе плагин ​I18N или нет.
  
-Notethe function ​i18n_load_texts ​is available in the I18N plugin ​1.0+.+**На заметку**функция ​i18n_load_texts ​доступна в версиях плагина ​I18N 1.0+
 + 
 +**На заметку**:​ На текущий момент плагин I18N поддерживает только языковые коды без наименования страны,​ таким образом,​ языковым файлам должны присваиваться имена ''​en.php'',​ ''​de.php'',​ и пр., ​ а не ''​en_US.php'',​ и.т.д.
  
-Note: The I18N plugin currently only supports language codes without country, so you must have language files like ''​en.php'',​ ''​de.php''​ etc. instead of ''​en_US.php'',​ etc. 
  
  
ru/plugins/i18n.txt · Last modified: 2013/10/09 12:23 by Arkady