wiki:Documentation/Internationalisation

Version 2 (modified by ray, 11 years ago) (diff)

changed reference to HTMLArea and htmlarea.js and added mime types for syntax highlighting of the examples

Internationalisation (i18n)

If you look for information on localisation (l10n, how you translate Xinha) take a look at wiki:Documentation/Localisation.

This page is for xinha-developers and on how the _lc-function works.

Context

Xinha has different contexts for i18n:

  • "Xinha": the core of Xinha uses this context.
  • eg. "InsertAnchor": every plugin has its own context (the name of the plugin)

the _lc-function

Error: Failed to load processor text/x-javascript
No macro or processor named 'text/x-javascript' found

This is the simplest usage, Xinha (core) will be used as context. The function will return the localised string.


Error: Failed to load processor text/x-javascript
No macro or processor named 'text/x-javascript' found

Usage within an plugin. Most plugins do have its own _lc function defined, you don't need to pass the context everytime then.

Error: Failed to load processor text/x-javascript
No macro or processor named 'text/x-javascript' found

Error: Failed to load processor text/x-javascript
No macro or processor named 'text/x-javascript' found

This provides a way to have complex sentences where some parts are variable - and this variable part might be at another position in other languages.


Error: Failed to load processor text/x-javascript
No macro or processor named 'text/x-javascript' found

It is also possible to translate objects, this is used to internationalize the bold, italic... toolbar-buttons.

The key is used to lookup the string (which is actually an object) in the l10n-file.