How do I create and use locales?

Sailwave is designed with UK English character strings. However, it facilitates the translation of these strings into other languages (or English variants) at run time by the use of locales.

A locale is a plain text file that translates the English strings into any other language. By using different character sets (also called charsets), Sailwave can be translated into Chinese, Japanese and Greek for example. Locales can be located anywhere on your computer. You can select a locale file and a character set from the Language tab of the Setup+GlobalOptions menu.

You can download locales from the Sailwave website download menu, or create them yourself.

If you download one, save it somewhere in say My Documents and then tell Sailwave where it is using the Folders tab in Setup+GlobalOptions.  You will probably need to restart Sailwave to see the results.

When new versions of Sailwave are released the locales can become out of date. When this happens Sailwave will update your locale file when you exit Sailwave for the first time after running the new version. Sailwave will tell you if this happens. New strings will be added requiring translation and obsolete string are moved to a special part of the locale for reference. You can delete obsolete string at any time; they are not used when translating the user interface, but they can be useful if I have just corrected a typing error or other small change.

The remainder of this topic covers how to create and edit your own locales.

A locale file must be a plain text file. Notepad on Windows is a plain text editor suitable for creating locale files. You can use any file extension for your locale file but .txt is a useful because Windows will fire up a plain text editor if you open a .txt file via My Computer – it’s also the Notepad default.

Start by getting Sailwave to create you a locale file containing an English to English translation using this procedure:-

Let’s say you are going to call your locale file “ger.txt”. Use Windows Notepad or any other plain text editor to create the file – but leave it empty (spaces and blank lines will in fact be ok but don’t type any visible charcaters). Start Sailwave and use the Language tab in Setup+GlobalOptions menu to point at your new (empty) file. Close Sailwave. Restart Sailwave. Close Sailwave. You should now find your file populated with an up to date English to English translation which you can use as the basis for your own translation.

Each locale file is divided into sections, one per window, called for example [WinEditCompetitor]. The contents of each section is then a list of translations for the named window.

Each section contains translations that apply to all controls in that window. Controls that are associated with text, and thus can be translated, are:-

Buttons
Entry field prompts
Check boxes
Radio buttons
Radio button groups
Fixed strings
Tab names
Window names
Tooltips
Menu names
Menu items

Each translation is specified as two lines that must be next to each other. An arbitrary number of blank lines can be placed between the pairs of translation lines. The first line of each pair must not be edited; it specifies a control type and control name. The second line is the text associated with the control and it is this line can that be translated into other languages. If you want to include a line break in your translation (e.g. for tooltip text), use a “|” character. If you want your control to be have a keyboard hot-key, precede the hot-key letter with a “&” character. Here is an example of a complete window section that has not been translated:-

[WinEditCompetitor]

WINDOW : Competitor
= Competitor

ENTRY-TIP : Tally_number_or_often_used_for_bow_number.
= Tally number or often used for bow number.

PROMPT : Tally
= &Tally

PROMPT : Fleet
= &Fleet

PROMPT : Flight
= Fli&ght

PROMPT : Boat_name
= Boat &name

PROMPT : Boat_class
= B&oat class

PROMPT : Sail_number
= &Sail number

PROMPT : Helm
= &Helm

ENTRY-TIP : ISAF_ID_for_crew.
= ISAF ID for crew.

PROMPT : ISAF_ID_of_helm
= ISAF ID of helm

ENTRY-TIP : The_helm_and_crew_for_double_handers_etc.
= The helm and crew for double handers etc.

PROMPT : Crew
= Cre&w

ENTRY-TIP : ISAF_ID_for_helm.
= ISAF ID for helm.

PROMPT : ISAF_ID_of_crew
= ISAF ID of crew

BUTTON : View_bio_entry
= View bio entry

PROMPT : Club
= Clu&b

PROMPT : Nationality
= &Nationality

ENTRY-TIP : Useful_for_noting_special_prizes_etc
= Useful for noting special prizes etc

PROMPT : Notes
= &Notes

PROMPT : Default_rating
= Default &rating

PROMPT : Wind_indexed_ratings
= Wind indexed ratings

CHECK : Exclude_competitor
= E&xclude competitor

CHECK : Edit_next
= Edit next

CHECK-TIP : Load_the_next_competitor_into_the_EditCompetitor__window
= Load the next competitor into the EditCompetitor window.

BUTTON : OK
= &OK

BUTTON : Cancel
= &Cancel

STRING : Check_this_value_is_correct
= Check this value is correct

CHECK : Wind_idx_ratings_enabled
= Wind idx ratings enabled

PROMPT : Rating_system
= Rating system

Here is an example of the same section partially translated into Swedish:-

[WinEditCompetitor]

WINDOW : Competitor
= Deltagare

ENTRY-TIP : Tally_number_or_often_used_for_bow_number.
= Tally number or often used for bow number.

PROMPT : Tally
= Nr

PROMPT : Fleet
= Grupp

PROMPT : Flight
= Fli&ght

PROMPT : Boat_name
= Båtnamn

PROMPT : Boat_class
= Klass

PROMPT : Sail_number
= Segelnummer

PROMPT : Helm
= Rorsman

ENTRY-TIP : ISAF_ID_for_crew.
= ISAF ID för gast

PROMPT : ISAF_ID_of_helm
= ISAF ID för rorsman

ENTRY-TIP : The_helm_and_crew_for_double_handers_etc.
= The helm and crew for double handers etc.

PROMPT : Crew
= Gast

ENTRY-TIP : ISAF_ID_for_helm.
= ISAF ID för rorsman

PROMPT : ISAF_ID_of_crew
= ISAF ID för gast

BUTTON : View_bio_entry
= ISAF data

PROMPT : Club
= Klubb

PROMPT : Nationality
= Nationalitet

ENTRY-TIP : Useful_for_noting_special_prizes_etc
= Useful for noting special prizes etc

PROMPT : Notes
= Anmärkning

PROMPT : Default_rating
= Grundranking

PROMPT : Wind_indexed_ratings
= Vindindexerad ranking

CHECK : Exclude_competitor
= Markeras ej deltagande

CHECK : Edit_next
= Ändra nästa

CHECK-TIP : Load_the_next_competitor_into_the_EditCompetitor__window
= Load the next competitor into the EditCompetitor window.

BUTTON : OK
= OK

BUTTON : Cancel
= Avbryt

STRING : Check_this_value_is_correct
= Check this value is correct

CHECK : Wind_idx_ratings_enabled
= Wind idx ratings enabled

PROMPT : Rating_system
= Ranking system

The “:” and “=” characters are important and must be present, although the the lines do not have to be indented in the way shown, which is just for clarity. The space characters either side of these delimiter characters are not needed either.

Sailwave is continually changing. It would be a huge job to check for changes with each release manually so Sailwave provides facilities to help you maintain your locale files with minimum effort.

When you start Sailwave one of the first things it does is check to see if your selected locale is up to date. If there are missing strings, Sailwave will update your locale file with English translations in the appropriate sections when you exit Sailwave. It will also move obsolete translations to a special section called [Obsolete] at this time. You should then edit your locale file, looking for new English text to translate, copying and pasting the relevant obsolete strings if the changes are small. Obsolete strings can then be deleted.

Notes

If you create your locale files using a non-ANSI charset; e.g. Japanese, you will need to select the appropriate charset in Sailwave via the Setup+GlobalOptions window. The following charsets are supported by default in Sailwave: USA+Western Europe, Eastern Europe, Apple Mac, Japenese (Shift-JIS), Chinese (GB2312), Taiwan (BIG5), Korea (Hangul), Korea (Johab), Greek, Turkish, Vietnamese, Hewbrew, Arabic, Baltic, Thai, Cryillic (Russia, Belarus, Ukraine, etc).

Do not edit your locale file while Sailwave is running.

Never under any circumstances change the first line of a translation pair.

If a control has a tip text, you’ll usually find it immediately after the translation for the control itself.

The controls in Sailwave are a fixed size so try and replace the English text with something of about the same size otherwise you may see truncation effects on controls where the text cannot wrap.

You must restart Sailwave to see the effects of your changes.