User Tools

Site Tools


igd:localization

Differences

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

Link to this comparison view

Next revision
Previous revision
igd:localization [2015/02/13 10:56] – created cr-wiki-adminigd:localization [2024/04/04 08:04] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Module Localization ======
 +
 +===== Resource Formats =====
 +
 +==== UTF-8 JSON ====
 +
 +A root-level dictionary where keys are the texts to be replaced and the values the replacements.
 +
 +===== Static Approach =====
 +
 +In this approach, a plain HTML file, let's say //page1.html//, will be converted to //page1_de.html//, //page1_fr.html// during the publishing process of the Module. By using the tool //IG.Localizer// simple text replacements will be performed, not limited to the exact inner text of text nodes, but can be more or less anything: partial texts, HTML statements, image urls, whatever.
 +
 +The //IG.Localizer// uses an options file that typically does the whole localization process for one Module. It even supports multiple resource files to be applied. In such case, the priority of a resource file decrements with its position in the resources array. This can be used to have specific overloads of more general texts.
 +
 +The static approach resp. //IG.Localizer// supports the following resource formats: UTF-8 JSON
 +
 +In order to force a Host to use the static approach you need to define the available locales, here //de// and //fr//, in the [[igd:module_reg|Module registration]].
 +===== Dynamic Approach =====
 +
 +In this approach, an HTML file will be localized dynamically at run-time. This is done typically in a document-loaded handler by retrieving a resource file (//GetTextResources()//) and iterating thru a sequence of DOM objects while replacing their src/innerText/innerHTML/etc. To use this you have to name the HTML objects to be translated, and also have to define an iterator on them, taking the specific replacement type into account.
 +
 +The dynamic approach supports the following resource formats: UTF-8 JSON
 +
 +