Multilingual Support
Version 0.2b added 2 years ago by tokyograph
HOW TO INSTALL: To install this package, copy the following code and paste it into your Pods >> Package Manager under the Import tab and follow instructions there.
0.2b Notes
Changed the display helper ml_translate so that it works with magic tags. Now, in your template, you can do:
{@fieldname,ml_translate}
{@fieldname,ml_translate}
About this Package
This is an experimental package to provide multilingual support in Pods. It consists of two Pod types (ml_languages, ml_translations) and three helpers (ml_input, ml_postsave, and ml_translate).
This package works with Pods 1.8.1 but may not be compatible with future versions. Use at your own risk.
----------Setup----------
After importing the Package, enter your additional languages in the ml_languages pod. The language_code is the abbreviation you want used in the url (e.g. if you set your Japanese language code to 'ja', then the url will need 'lang=ja' to show the Japanese translations).
You do not need to create an item for your blog's primary language. Only secondary language translations will be stored in the ml_translations pod.
To enable Multilingual Support for a Pod:
1) Add ml_postsave as a post-save helper.
2) For each text/paragraph/code field that you want translations for, set ml_input as the input helper.
Note: Multilingual Support currently does not work with nicEdit. All paragraph text fields will be treated as code fields.
Note: You can disable Multilingual Support for a field by removing the ml_input helper. All translations still remain in the database, so they will be available again if you re-enable the helper later.
----------Displaying Translations----------
The display helper, ml_translate, does not work like a normal display helper - it can not be used with Magic Tags. In order to use it, you must use the pod_helper function and provide the *name* (not the value) of the field you want translated.
Example, within a Template page:
echo $this->pod_helper('ml_translate', 'fieldname');
This package works with Pods 1.8.1 but may not be compatible with future versions. Use at your own risk.
----------Setup----------
After importing the Package, enter your additional languages in the ml_languages pod. The language_code is the abbreviation you want used in the url (e.g. if you set your Japanese language code to 'ja', then the url will need 'lang=ja' to show the Japanese translations).
You do not need to create an item for your blog's primary language. Only secondary language translations will be stored in the ml_translations pod.
To enable Multilingual Support for a Pod:
1) Add ml_postsave as a post-save helper.
2) For each text/paragraph/code field that you want translations for, set ml_input as the input helper.
Note: Multilingual Support currently does not work with nicEdit. All paragraph text fields will be treated as code fields.
Note: You can disable Multilingual Support for a field by removing the ml_input helper. All translations still remain in the database, so they will be available again if you re-enable the helper later.
----------Displaying Translations----------
The display helper, ml_translate, does not work like a normal display helper - it can not be used with Magic Tags. In order to use it, you must use the pod_helper function and provide the *name* (not the value) of the field you want translated.
Example, within a Template page:
echo $this->pod_helper('ml_translate', 'fieldname');
