Difference between revisions of "Internationalization/developer manual"

(Loading the localizator)
m (Cosmetics)
Line 1: Line 1:
 
[[Category:Internationalization]]
 
[[Category:Internationalization]]
  
= Developer manual =
+
= How to design the software =
  
== How to design the software ==
+
= How to use the library =
 
+
== How to use the library ==
+
  
 
Here you can find instructions on how to use our library; how to initialize the system and how to make the translations actually appear in your application.
 
Here you can find instructions on how to use our library; how to initialize the system and how to make the translations actually appear in your application.
  
=== Initialization ===
+
== Initialization ==
  
 
To initialize the library you should have a class that inherits from the SHARED_I18N_LOCALIZATOR; this will bring you all the necessary infrastructure to start localizing your software.
 
To initialize the library you should have a class that inherits from the SHARED_I18N_LOCALIZATOR; this will bring you all the necessary infrastructure to start localizing your software.
Line 18: Line 16:
 
* load localizator
 
* load localizator
  
==== Creating a datasource ====
+
=== Creating a datasource ===
  
 
We equip you with a simple factory to create the sources, simply create an I18N_DATASOURCE_FACTORY
 
We equip you with a simple factory to create the sources, simply create an I18N_DATASOURCE_FACTORY
Line 48: Line 46:
 
The datasource is ready, you should create a datastructure for storing the strings.
 
The datasource is ready, you should create a datastructure for storing the strings.
  
==== Creating a datastructure ====
+
=== Creating a datastructure ===
  
 
We provide you with a simple factory to create datastructures, so follow the example
 
We provide you with a simple factory to create datastructures, so follow the example
Line 78: Line 76:
 
Now that you have the datastructure ready, you can load the localizator.
 
Now that you have the datastructure ready, you can load the localizator.
  
==== Loading the localizator ====
+
=== Loading the localizator ===
  
 
It's important that you do this part before trying to localize any string, if not, the localizator would serve you what you pass as argument.
 
It's important that you do this part before trying to localize any string, if not, the localizator would serve you what you pass as argument.
Line 104: Line 102:
 
{{Warning|If you don't assign a source AND a structure AND then call load, the system will continue to use the old ones.}}
 
{{Warning|If you don't assign a source AND a structure AND then call load, the system will continue to use the old ones.}}
  
=== Localization ===
+
== Localization ==
  
== How to translate / use translation files ==
+
= How to translate / use translation files =

Revision as of 08:54, 21 June 2006


How to design the software

How to use the library

Here you can find instructions on how to use our library; how to initialize the system and how to make the translations actually appear in your application.

Initialization

To initialize the library you should have a class that inherits from the SHARED_I18N_LOCALIZATOR; this will bring you all the necessary infrastructure to start localizing your software.

What to do?

  • create datasource
  • create datastructure
  • load localizator

Creating a datasource

We equip you with a simple factory to create the sources, simply create an I18N_DATASOURCE_FACTORY

datasource_factory: I18N_DATASOURCE_FACTORY
 
create datasource_factory.make

you now have the possibility to create a new source based on an mo file, as follows

datasource: I18N_DATASOURCE
 
datasource_factory.use_mo_file(mo_file_path)
if datasource_factory.last_datasource /= Void then
  datasource := datasource_factory.last_datasource
end

if something went wrong, you can alway fallback with an empty datasource

datasource_factory.use_empty_source
datasource := datasource_factory.last_datasource

The datasource is ready, you should create a datastructure for storing the strings.

Creating a datastructure

We provide you with a simple factory to create datastructures, so follow the example

datastructure_factory: I18N_DATASTRUCTURE_FACTORY
 
create datastructure_factory.make

You can now create, for example, an hash table

datastructure: I18N_DATASTRUCTURE
 
datastructure_factory.use_hash_table
if datastructure_factory.last_datastructure /= Void then
  datastructure := datastructure_factory.last_datastructure
end

and, even in this case, if something went wrong, you can create a dummy datastructure

datastructure_factory.use_dummy
datastructure := datastructure_factory.last_datastructure

Now that you have the datastructure ready, you can load the localizator.

Loading the localizator

It's important that you do this part before trying to localize any string, if not, the localizator would serve you what you pass as argument.

Pass the source to the localizator

i18n_use_datasource(datasource)

then pass the datastructure

i18n_use_datastructure(datastructure)

and finally load the localizator with the new source and structure

i18n_load

You now have a working localization environment!

Warning.png Warning: If you don't assign a source AND a structure AND then call load, the system will continue to use the old ones.

Localization

How to translate / use translation files