This widget is a tool used to internationalize other pxxo widgets. It shows in a first tab a list of all available languages (locales) and the translated percentage status. In a second tab it makes possible to edit the text items in different languages: a first column shows the label key, then the two other columns are used to compare two languages together. It makes it easier to understand the correspondence of each labels.
Pxxo_Widget_Pxxo_Translator)| Name | Default value | Description |
|---|---|---|
i18n_path | - | An absolute path where your translation files are stored. Most of the time it's …/default/i18n (mandatory) |
locale_ref | “en_US” | The locale that will be used as a reference to compare with other locales (can be changed dynamicaly by the user) |
translate_data_pattern | '/\\$this\→TranslateData\[(.*?)\]\s*=\s*(.*?);/s' | A regex to capture the translated data keys and values. Most of the time this parameter should not be changed. |
translate_data_format | '$this→TranslateData[%key%] = %data%;' | A template string used to generate the translated data when it need to be written in the file. Most of the time this parameter should not be changed. |
display_filename_length | 30 | How many characters should be used to truncate the filename path (in the status tab table). |
This example shows how to edit the translation file located in …/pxxo_translator_data:
require_once "Pxxo/Widget/Pxxo/Translator.php"; $params = array(); $params['i18n_path'] = dirname(__FILE__).'/pxxo_translator_data'; $o = new Pxxo_Widget_Pxxo_Translator($params); $o->addDecorator('Pxxo_Widget_Decorator_Core'); $o->main(); $o->dump();