Experimental project
This is a sandbox project, which contains experimental code for developer use only.
GitHub: https://github.com/z7/Drupal-module-simple_i18n
The Simple I18n module implements a trivial patter matching markup to enclose your localizable strings. Anything that is sent to the user using a theme page template (and is not published in the /admin section) gets parsed by this module, so when the markup is found it is automatically filtered and otputted in the current language.
Uses
For localizing menu links, terms, views, field labels, ...
Use the simple in-line markup:
[[@ Primary language string; Other language; Third one; ... ]]
Translated string should be listed in the same order as site languages are in Regional and language configuration page.
Localizing longer texts
If your text contains the ";" symbol, use this:
[[@ Primary language string;; Other language;; Third one;; ... ]]
Localizing texts with markup (usually HTML)
To prevent chopped tags and other side effects when using WYSIWYG editors, explicitly define language for each translated fragment, by using "[[@language_code: ... ]]" syntax, example:
[[@fr: Le text en francais ]]
Please note that the parser will remove empty tags around inactive translations for you, but, other than this, will not change any part of the DOM, so you may want to check the output for each language, until you get used to how it works.
Project information
- Project categories: Multilingual
- Created by z7 on , updated