How do I create and use locales?

Last edit 28th February 2018 by Jon

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.

From Version 2.25 there are two Locale Files the new file has the same name as the original but with an “M” appended  e.g. ITA.txt and ITAM.txt and must be in the same directory.

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,  although we recommend using C:\Users\Public\Documents\Sailwave\Locale and sub folders of this location.  By default the Italian Locales use  C:\Users\Public\Documents\Sailwave\Locale\ITA.txt  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.  Italian Locales are included in the Installer.

If you download one, save it somewhere, we suggest using the folder  C:\Users\Public\Documents\Sailwave\Locale 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 or Notepad++ are plain text editors 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 characters). Lets put it in C:\Users\Public\Documents\Sailwave\Locales\GER.txt 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.

The ‘M’ File for dynamic text Translation

From version 2.25 there is an additional translation file which handles all the text that needs translation but is not specific to a window.  This is handled by an addition text file e.g.  ITA.txt and ITAM.txt.   Where as, in the first file if the same text appears in multiple windows it will appear multiple times and the translation is entered multiple times.  In the ‘M’ File each word or phrase will only appear once in the file no matter how many times it appears in Sailwave.

The latest un-translated ‘M’ file can be downloaded from here.
Updated 28/02/18 to be compatible with 2.25.2

The format of the file is a simply a few hundred lines of text

The first 3 lines look like this

Please select a target field
Please select a field to copy from
Cannot copy from/to same field!

Lines like this are ignored – If you wish to translate the phrase insert a hyphen “-” as the first character and then follow the next line starting with the equal “=” and the translation, so that it would become

-Please select a target field
=Seleziona un campo target
-Please select a field to copy from
=Selezionare un campo da cui copiare
-Cannot copy from/to same field!
=Impossibile copiare da / verso lo stesso campo!

Do not ever edit the original text other than to insert a hyphen at the beginning of the line to tell Sailwave you are supplying a translation.  No lines must ever be more than 500 characters in length.

This file also includes translations for right click menus e.g.

-Edit cell...|-|Cut cell|Copy cell
=Modifica cella...|-|Taglia cella|Copia cella

Take care not to modify the symbols only change the text

Column header translations are also included in the file but note these are only translated when you create a new series – this allows the scorer to rename them as they require.  Column headers all start with the “^” symbol.

^Rank
-^Medical
=SanitInfo
-^Tally
=Progressivo
-^BowNumber
=NumPrua

In the above example Rank is not translated as it is not preceded by a “-”  but BowNumber is translated to NumPrua

Note some column headers consist of two parts e.g. HelmName, HelmAgeGroup, HelmEmail.  Each part is translated separately so Helm and AgeGroup are translated separately.  The first part is optional if you translate it, but the second part must always be translated even if it is the same

-^Name
=Name
-^Id
=Id
-^AgeGroup
=AgeGroup
-^Email
=Email
-^Website
=Website
-^Sex
=Sex
-^MemberNo
=MemeberNo
-^Phone
=Phone
-^Photo
=Photo
-^Address
=Address
-^Notes
=Notes

This file must be in the same directory as the first file.