Difference between revisions of "Karma/i18n"

From Sugar Labs
Jump to navigation Jump to search
Line 6: Line 6:
 
   Examples  
 
   Examples  
 
   $("#someDiv").text(gettext("Hello World"));
 
   $("#someDiv").text(gettext("Hello World"));
 +
  <nowiki>
 
   <div>Hello <strong>W</strong>orld</div>
 
   <div>Hello <strong>W</strong>orld</div>
 +
  </nowiki>
  
 
* All strings stored in one file per locale, messages.json
 
* All strings stored in one file per locale, messages.json

Revision as of 09:32, 24 February 2010

Rough plan for implementing i18n for Karma

Requirements

  • Integrate with pootle
  • Handle strings inside code and html markup
 Examples 
 $("#someDiv").text(gettext("Hello World"));
 
  <div>Hello <strong>W</strong>orld</div>
  
  • All strings stored in one file per locale, messages.json
  • All message identifiers must be unique within an a lesson
  • Accommodating numeric, currency, and date formatting is not an immediate requirement

General Strategy

  • Use a modified version of gettext, where the key for getting translations, we will use an arbitrary message identifier. This will remove the need for managing translation contexts.
  • We will try to use the Internationalization Tag Set for handling strings inline with html. The Okapi tool may be able to parse out strings marked with ITS.
  • We will use this lesson for prototyping examples/6_Maths_matchingAnglesAndShapes/
  • For the immediate future we will dynamically change out strings per locale on page load