home
products
education
support
partners
company

introduction

get started

articles

manual

tutorials

reference docs

case studies

knowledge base

goodies

screenshots

demos

echoes

Carousel zone




home

forums

downloads

bugs

mailing list
XUI Zone - manual

number of ratings 0
average rating 0.00

21 The Language Editor

[This is a feature of Carousel]

A quick tour

The language editor is a simple to us facility for editing and localizing the text used within an application. At the core of the editor are two lists of strings, the lists are termed the source and target, each can be a different language. The basic idea is to pick a string from the source language and then enter the translation. The translation is entered in the editor window in the bottom right of the application. So in theory, the process of localizing an application is just a matter of iterating through the list of strings and entering the text of the translations.

Going beyond the most basics translation you will almost certainly need the support of language experts and the language editor can use some additional information such as keywords (for use by the application programmer), string IDs (again for use by the programmer) and hints to give the translator some contextual information about the string being translated.

The language editor also provides some support for the import and export of language files and resources so that the work of translation can be continued outside of the Carousel environment.

Elements of the language editor

Below is a screenshot showing the language editor

The key elements of this editor are:

Table 21-1 - The language editor's key elements

Toolbar

The toolbar contains a number of buttons that allow you to import, export and add strings. You can also sort the string alphabetically or numerically and select the languages.

Source language list

The first dropdown list in the toolbar allows you choose the source language, that is the language from which you are translating.

Target language list

The second dropdown list in the toolbar allows you choose the target language, that is the language to which you are translating.

Source language

This list, displayed on the left hand side of the editor contains all the strings or pieces of text that the language editor knows of. The list also shows the index of the string within the resource.

Target language

The target list contains a list of strings in the translation or target language. Initially this list may be empty if not strings have been translated.

Preview area

The preview area shows the string as it will appear, complete with any substitutions. The preview area will also show a gray background for part of the string if the translation exceeds the length of the source string.

Editor's hints

The hints area (in the bottom left) shows the translator's hints and these may include information about the string's context, information that is important if the text is not enough to allow an unequivocal choice of translations.

Editor field

This field in the bottom right of the editor is where you can enter your translations.

Choosing the languages

Now that the language resources have been opened the language lists have been filled with the reference and the English languages. In many cases the reference language is only of interest to the programmer and may contain what might seem like cryptic codes. For a normal translator it is probably easier to translate from one natural language to another, for example from English into French.

The two lists shown are termed the source and target lists. Translation operates by choosing a string in one language and entering the translation for target language. Note that unless you are adding new strings the source language is unaffected by any translations you enter, changes are made to the target language.

The main menu should now have two new options for the Source and Target languages. Each of these menus contains a list of all the possible languages. Choosing from the source menu will select the source language and the left hand list will be updated to show this language. The title of the source list will also show the selected language's name. Similarly choosing a language from the Target menu will change the right hand side list.

If you are following this tour choose English as the source language and French as the target language.

Translation

To translate a string all you need to do is find it in the source language or in the target language. The source language also lists the ID of the string and in some situations it may be useful in locating the relevant string.

The hints shown at the bottom left of the language editor may also be of use in locating a string if two or more strings are similar. In such situations the hint may give useful information about the context of the string.

Once a string has been chosen it is shown in both the translation area and the preview area.

The preview area shows the string as it will appear in the application (although the font and line breaks will differ). The preview area shows the text following any substitutions or replacement of keywords and line breaks.

The translation area at the bottom right is an editor where you can type in the text of the string in the target language. That's it!

Spell checking

Before you finish with a string you may want to check the spelling. The language editor includes a spell checker, it can invoked by choosing the Language | Check Spelling... menu option or by pressing the CTRL+L keys.

If there is a spelling error or a word cannot be found in the spell checker's current word list then the dialog on the right will be shown.

The spell checker operates as you would expect. The suggestions list shows words that are similar to the unrecognized word and the buttons on the right of the dialog allow you to change the spelling or add the word to the dictionary.

For a technical application not all words may be found in the dictionary unless it has been customized. Some strings may also contain keywords or other idioms used by the programmer and these will not be found in the dictionary (and they probably shouldn't be added either).

When the spelling has been corrected click the Change or Change All buttons to update the translation.

Setup

The language editor can operate with a number of different file formats or by connecting to an SQL database. If you are planning to work with files you need to do little configuration, however if you plan to work with databases you will need to configure the database access.

Database configuration

The language editor relies on a JDBC database connection. In order to configure this connection you must ensure that the required drivers are available. You must also ensure that the necessary permissions are available to the user. Since the configuration parameters will depend largely on the database you are using you should consult your database documentation for the necessary details.

In many cases you will be able to connect via an ODBC driver. An ODBC driver is installed by default with Java and all you need to do is to ensure that the ODBC DSN has been configured. You can do this form the Windows control panel.

ODBC is limited to the Windows platform and to intranets. If you need to operate on another platform or via the Internet then you should use a JDBC driver. The language editor includes predefined settings for ObjectWeb's rmi-odbc driver. This driver allows ODBC to be used over the internet but requires that you install additional software on a web server. For more details see the ObjectWeb site.

The language editor also includes predefined strings for Microsoft's SQL Server driver. The driver for SQL Server can be downloaded from the Microsoft site.

Connecting to a database

Once the database driver has been configured you can start the language editor and attempt a connection. A connection is initiated by choosing the File | Connect... option or by pressing the connection button on the toolbar. Then the following dialog appears.

The dialog allows you to enter the settings that control the driver and the connection.

Table 21-2 - Database parameters

Parameter

Usage

Driver

This is the name of the Java/JDBC class that implements the database driver. See your driver's documentation for details. For example for use of ODBC on a local machine or intranet this will be sub.jdbc.odbc.JdbcOdbcDriver .

Database (DSN)

This is the name of the database. For an ODBC DSN it will correspond to the database DSN (prefixed by 'jdbc:odbc:') as entered on the control panel.

Username

This is the user name used to access the database. You will need to obtain a user name from the database administrator.

Password

This is the password associated with the user name, again you will need to obtain this from the database administrator. This value is saved between sessions.

Languages Table

The table used to hold the description of the languages and the field used for each language within the Translations Table.By default this table is called CS_LANGUAGES

Translations Table

The translations table hold the text of the various translations. Each language has a field of its own. By default this table is called CS_TRANSLATION

Once you have filled in the correct information click OK to make the connection. After a few seconds (depending on the size of the language tables) the source and target lists will be filled with the set of strings from the languages. On the left, the source list will show the reference language while the right hand list will show the English translation (or the first proper language in the translation set).

The formats of these tables are described in the formats sections

Starting a file based session

A file based session can be started at any time by choosing the File | Open... menu option, or by clicking on the Open button on the toolbar.

The open file dialog is shown adjacent.

To start a translation session use the dialog to locate a language list file. The language list file contains a list of the files that make up a language set. Once the file has been chosen the language files are opened and the source list shows the reference language while the target list shows the first available language which is normally english.

When using a file based session any new languages will cause a new language file to be created in same the directory as the language list file.

When using a file based session it may also be important to ensure that the source language is the reference language if new strings are to be added to the language and if the application programmer intends to use the string IDs in the coding of the application. The reference language should be considered as a master language and therefore it is important to ensure that it contains an entry for every string. In other languages this is no so important as a default translation may be provided.

Choosing languages

Once the language set has been opened regardless of the data store used you will be presented with two lists of strings. These two lists are termed the source and target languages. The main menu contains a menu for each from which you can choose the languages to be displayed.

The source menu allows you to choose the language displayed in the left hand side source language list, while the target menu allows you to choose the language for the target list.

As you change the languages the caption of each list is changed to show the associated language.

The source list also shows the ID of each string.

Configuring the spell checker

The language editor includes an open source spell checker. This spell checker can be configured to work with dictionaries for a variety of languages. These dictionaries take the form of a compressed (zipped) word list. Word lists for many languages can be found on the internet from the likes of the ASpell project. 

The spell checker by default works with english. If you want to use another language then select the language's word list file by choosing the Language|Spell check setup... menu option and choose the appropriate zip file.

Starting a new project

For a database based system

1. Setup a new blank database

2. Add the required tables using the following SQL statements

3. CREATE TABLE [dbo].[CS_LANGUAGES] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [Name] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL , [Code] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL , [Description] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL ) ON [PRIMARY]

4. CREATE TABLE [dbo].[CS_TRANSLATION] ( [ID] [int] NOT NULL , [Reference] [nvarchar] (4000) COLLATE Latin1_General_CI_AS NULL , [Hints] [nvarchar] (4000) COLLATE Latin1_General_CI_AS NULL , [EN] [nvarchar] (4000) COLLATE Latin1_General_CI_AS NULL ) ON [PRIMARY]

5. Setup the ODBC DSN if the JdbcOdbc driver is going to be used

6. Choose the File|Connect menu option and select the appropriate settings

For a file based system

7. Choose the File|New ... menu optio n

8. Navigate to a new folder and enter the langlist.lst as the name of the language list.

Opening a file

A file based session can be started at any time by choosing the File | Open... menu option, or by clicking on the Open button on the toolbar. The open file dialog is shown adjacent.

Adding a language

To add language you must have opened a set of language resources. Then all you need to do is choose the Language|New Language... menu option. The following dialog then appears.

The code is used to name the language file and should be a two or three letter code. The ISO language code is normally a good choice.

The name of the language can be whatever you like but should preferably be in the language itself. Some applications present a list of languages to the user and therefore show the language name to the end user.

Adding a new String

A new string can be added to the language by choosing the Language|New String menu option or withe CTRL+W keystroke combination.

Once the new string has been added some dummy text is inserted and displayed in the translation editor at the bottom right of the application.

Adding a translation

To translate a string all you need to do is find it in the source language or in the target language. The source language also lists the ID of the string and in some situations it may be useful in locating the relevant string.

The hints shown at the bottom left of the language editor may also be of use in locating a string if two or more strings are similar. In such situations the hint may give useful information about the context of the string.

Once a string has been chosen it is shown in both the translation area and the preview area.

The preview area shows the string as it will appear in the application (although the font and line breaks will differ). The preview area shows the text following any substitutions or replacement of keywords and line breaks.

The translation area at the bottom right is an editor where you can type in the text of the string in the target language. That's it!

Sometimes the target language may not contain any translation for the string and in such situations it is best to find the translation in the comments language.

The language editor includes a menu option to add all strings from the source language to the target language where the target language does not contain a translation. This can be useful if you wish to provide a default for the string even if you do not intend to translate it immediately.

Substitutions

Substitutions are a special feature of Xoetrope's language editor libraries and are not relevant if you are using the text resources in some other way.

A string can include a word or phrase that appears in the reference language and delimited by special characters. Such pieces of text are referred to as substitution strings. Substitutions are made by looking up the keyword and replacing it with the translation of that keyword. For example, one string might contain

Table 21-3 - A simple substitution in its raw form

Will the real ¦slim_shady¦ please stand up

here the keyword slim_shady is delimited by the ¦ characters. Supposing that the language contains an entry for the keyword such that it would be translated as ' Marshall Mathers ', then the text would appear to the end user as

Table 21-4 - The processed string, complete with substitution.

Will the real Marshall Mathers please stand up.

Special substitutions

When the language files are saved as files then any carriage returns line feed (CRLF) pairs or newline characters must be replaced so that they do not cause problems in storing the data. For this purpose the language editor uses the ¦CRLF¦ keyword to substitute for the CRLF pair.

Remote translation

In some situations a translator may not be able to or wish to connect to the main database holding the languages. In such situations it is possible to export the language resources to a directory. The directory contents can then be sent to the translator via e-mail, disk or other means.

The remote translator can then open and update the file based language resource and return the file set to the person responsible for administering the language resources. The remote translator will not be able to add new strings or new languages.

The administrator can then import the updated files received from the remote translator. The administrator will be asked to confirm the merging of each language. In this way updates to an individual language can be loaded and other rejected.

File formats

Database table formats

The database tables are described below using the SQL CREATE TABLE statement.

Table 21-5 - Database language table setup

CS_LANGUAGES

CREATE TABLE [dbo].[CS_LANGUAGES] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [Name] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL , [Code] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL , [Description] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL ) ON [PRIMARY]

CS_TRANSLATION

CREATE TABLE [dbo].[CS_TRANSLATION] ( [ID] [int] NOT NULL , [Reference] [nvarchar] (4000) COLLATE Latin1_General_CI_AS NULL , [Hints] [nvarchar] (4000) COLLATE Latin1_General_CI_AS NULL , [EN] [nvarchar] (4000) COLLATE Latin1_General_CI_AS NULL ) ON [PRIMARY]

Each new language field is setup using the language code in uppercase as the field name and with a type of NVARCHAR(4000) .

Flat file formats

The Language Editor can use a set of text files to store the languages. The files are cross referenced via a language list ( .lst ) file. The format is quite simple.

The language list (.lst) file

First the file lists the number of languages and then using one line per language it lists the languages. Each line specifies the language ID, the language (ISO) code and the language name. Each field is separated by the '|' character. An example listing two languages is shown below plus the reference language and the hints language. The reference and hints language should be specified as shown in the example.

Table 21-6 - The language list


0|Reference|Reference
1|Hints|Hints
2|EN|English
3|US|US-English

The language (.jln) file

The language file contains the strings belonging to an individual language. The language file first lists the number of strings in the language and then using one line per string it lists the string. Each line contains the string ID followed by the text of the string. A fragment of a language file is shown below.

Note that the example shows some strings containing special words delimited by the '¦' character. These delimited words can be substituted by text for other texts. The delimited text normally is a keyword found within the language. Some special substitution keywords are used, for example CRLF is used to mark a point where a carriage return-line feed pair should be inserted (since the convention of one line per string cannot on its own support multiline texts).

Table 21-7 - Sample language file

855
863|No matching valve was found, a balanced port valve or a larger connection may be available instead
862|Strainer
861|WARNING: Due to range limits some input values have changed. Press the forward button again to continue
860|No matching valve was found, a single port valve or a smaller connection may be available instead
859|Application:¦CRLF¦D: Temp. controlled defrost¦CRLF¦F: Fan control¦CRLF¦A: Alarm relay
857|Auto
856|ODF Solder 1/4 in.
855|Flare 6 mm
854|CutRing 6 mm
853|ODF Solder 6mm
852|Flare 1/4 in.
848|A = Alarm¦CRLF¦D = Defrost¦CRLF¦F = Fan
847|PTC 1000 Ohm sensor
846|Pt 1000 Ohm. sensor

The substitution (.sub) file

The format of the substitution file is exactly the same as the language file (.jln). In fact it is a subset of the reference language. The substitution file contains only those strings that start and end with the delimiter character mentioned above.

Property files

The property files (.properties) produced when saving flat files are largely similar to the .jln files described above. Each string is recorded with the ID being used as the keyword.

Exporting to Microsoft Excel

When exporting languages it is possible to generate an Excel workbook for the languages. Sometimes this can be useful as just about everyone is familiar with Excel. Export to Excel makes it easy to distribute the language files for translation even though the language editor can run as a standalone application.

When the export dialog appears and the desired export languages have been chosen, simply remember to check the Export Excel Worksheet checkbox.

An Excel workbook will be created with a worksheet containing a column for each language exported. Of course Excel doesn't really know anything of the relationship of the various fields and IDs so some care is needed if Excel users try to add strings to the language or if they delete cells. So, when re-importing the Excel sheet it is a good idea to backup the language files. It is probably also a good idea to keep a copy of the initial export for comparison purposes in case some conflict arises when importing the files.

Using the standalone language editor prevents some of these issues.

comments


If you were logged in you could rate this article or add a comment.