What is Internationalisation?
Internationalisation is the process of designing an application so that it can be adapted to various languages and regions without engineering changes.
When an application is first built it may be assumed that it will only ever be used in a single language, which leads to all screen labels, titles and error messages being hard-coded within the application code. A major problem then arises when someone asks "Can we provide this application in language X?"
One method would be to take a copy of the entire application and change all the relevant hard-coded text, thus producing a completely separate version of the application which now runs only in language X. This causes a major problem because now there are two copies of the same source code, but with different text, which need to be maintained. Now add in language Y and language Z and you will see the problem growing exponentially.
A better approach would be to take all text (labels, titles, error messages, et cetera) out of the program code and into a separate file. This may be a database or a non-database file. If each piece of text is given a unique id then all the application has to do is provide a mechanism which responds to the instruction "give me the text for id A and language B". This mechanism will then go to the text file, retrieve the relevant entry, and return it to the application.
The RADICORE approach is based on having text in separate files as follows:
- All files are non-database. This makes it easier to provide someone with a copy of an existing file so that its contents can be translated into a different language.
- There is a separate file for each application subsystem. Thus the text for the RBAC system is kept separate from the Workflow system, which is separate from the Data Dictionary, and so on. As it is only possible to run a single component at a time it is only necessary to load in the text for that component's subsystem.
- There is a separate file for each language. As each web page will contain text in a single language there is no need to load in the text for any other languages.
- Each subsystem will therefore have its own
/textsubdirectory for its language files, and this directory will have a separate subdirectory for each language code such as
/text/es. Each of these language subdirectories will contain a file of the same name but with different content.
- At runtime the user's language is determined from the browser settings, but may be overridden by a setting on his USER record. The framework will then look for a file in a subdirectory with that language code. If one does not exist then it will revert to the application's default language.
- In all program code the relevant text can be obtained at runtime using a statement similar to the following:
$text = getLanguageText($id, [$arg1, $arg2, ...]);Up to 5 optional string arguments are allowed which will cause those strings to be inserted into the designated places in the language text
This means that a RADICORE application can be provided in another language with the following simple steps:
- Create a language subdirectory using the code of the designated language.
- Populate this subdirectory with a file containing the translated text.
For more details please refer to:
- Internationalisation and the Radicore Development Infrastructure (Part 1)
- Internationalisation and the Radicore Development Infrastructure (Part 2)
Published: 09 April 2006