Fri, Jan 28, 2005

Internationalisation (I18N), which, once built into an application, allows Localisation (L12N), so users can choose which language to use. Some applications are i18n enabled but come with mutually exclusive language packs, so the interfaces are only ever available in one language, although that language can be changed. They support i18n but dynamic i12n is not supported.

Having worked on many i18n efforts over the years, I’ve become used to dynamic language switching of the user interface, which gives you a great language learning tool too. For example, when I’m perusing a Gaelic localised interface, if I’m not sure of a term, I can quickly switch back to English to see what it is, then back to Gaelic. Great if your memory is as bad as mine :) So, this answered the question of whether to support dynamic language switching - yes!

So, what’s involved in i18n for bodington?

while the other adds the getLanguage() and setLanguage() methods to the User object’s database presence. This is required for the User.save() method to function: INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign ) VALUES(1, 10, ‘language’, ‘setLanguage’, ‘getLanguage’, ‘java.lang.String’, ‘java.lang.String’, 0, null, null, null )

So now that the engine is in place, how do you localise a template?

<template facilityclass=“org.bodington.servlet.facilities.Facility”> <i18n resource-path=“lang” resource-file=“test_template.properties”/> <head><title><localise id=“1” /></title></head>

and the resource file for the Gaelic version of the template, [TEMPLATE_DIR]/lang/gd/test_template.properties, looks like: 1=Test template title

language_debug=off There are 3 settings for this:

The following properties are used by SqlDatabase.localiseObject: sql_verify_localised_table=SELECT big_string_id from big_strings_LANGUAGECODE where big_string_id = ‘IDsql_create_localised_table=CREATE TABLE big_strings_LANGUAGECODE (big_string_id int NOT NULL, string TEXT, CONSTRAINT PK_big_strings_LANGUAGECODE PRIMARY KEY (big_string_id), CONSTRAINT FK_big_string_to_objects FOREIGN KEY (big_string_id) REFERENCES objects (id)) sql_update_localised_string=UPDATE big_strings_LANGUAGECODE set string = ‘STRING’ where big_string_id = ‘IDsql_insert_localised_string=INSERT INTO big_strings_LANGUAGECODE (big_string_id, string) VALUES ('ID', ‘STRING')

comments powered by Disqus