SpaceMonger Customization
 

[ Prev: 2. The Basics | Up: Contents | Next: 4. Menus ]    
      
   3. Strings     

Over half of a language file consists of translated, unstructured strings. Thus this section describes these very important facilities.

 
   3a. String Tags     

Each string tag contains exactly one text string in a given language. Here are some examples from the U.S. English file:

<string name="OK">OK</string> <string name="Cancel">Cancel</string> <string name="Apply">Apply</string> <string name="Cluster-Map">Cluster Map</string> <string name="help"> [B]Have questions? Found a bug? Want a feature?[/B] Send your e-mail to &lt;spacemonger@sixty-five.cc&gt; and we will be happy to hear what you have to say.[BR] </string>

Here are the same examples from the French language file:

<string name="OK">OK</string> <string name="Cancel">Annuler</string> <string name="Apply">Appliquer</string> <string name="Cluster-Map">Plan des cluster</string> <string name="help"> [B]Des questions? Trouv&eacute; un bug? Besoin d'une nouvelle fonctionnalit&eacute;?[/B] Envoyez vos email &agrave; &lt;spacemonger@sixty-five.cc&gt; et nous seront heureux de vous &eacute;couter.[BR] </string>

When SpaceMonger wants to display a string of text, such as "Cancel", it searches the database to find the appropriate string to display. Thus to display the correct string for a "Cancel" button in French, SpaceMonger searches for commmon/buttons/Cancel, thus finding the "Cancel" string inside the "buttons" group which is inside the "common" group:

<string name="Cancel">Annuler</string>

When it finds that string, it then knows to display "Annuler" every time it wants to display "Cancel".

The text for "help" above is obviously a fake example, but it serves to demonstrate several important principles. First, in several places where long text strings can be displayed, SpaceMonger will automatically wrap the text to additional lines as necessary. Second, you can use HTML entities (things like &...;) instead of the literal characters. (You should use entities like &eacute; instead of é wherever possible, because it helps to maintain portability.) Third, long strings can often be formatted using HTML-like tags; for example, [BR] for "line-break" and [I] for italics.

If you're not interested in foreign languages and you're only intrested in customization, you can replace the strings for a variety of different effects. For example, here's the same set of strings in California Surfer:

<string name="OK">Duuude</string> <string name="Cancel">Weak</string> <string name="Apply">Sweet</string> <string name="Cluster-Map">Cluster Me</string> <string name="help"> [B]Like got questions? Somethin' lame? Awesome concept?[/B] Dude, whip your e-mail over to &lt;spacemonger@sixty-five.cc&gt; and we'll like totally read it and shoot one back.[BR] </string>

In general, you should be sure to match capitalization if your language uses capitalization. So if you see a string named "Cancel", you should replace it with "Annuler" and not "annuler" or "ANNULER".

By the way, if you're preparing a configuration file for a new language, be sure to test in several different fonts to make sure that all of your text fits without any getting chopped off. In particular, if your language uses Roman or Cyrillic characters, be sure to test with both of Microsoft's Arial and Verdana fonts, because Arial is SpaceMonger's default, and Verdana is very wide.

 
   3b. Special Strings     

If you're doing a complete translation, there are some strings to which you should pay special attention:


<string name="and">$text and $text</string> <string name="from">from $text</string>

SpaceMonger will use the "and" string in places where it needs to join two strings together with the conjunction "and". The two $texts will be replaced with the actual strings being joined. Thus if SpaceMonger wants to display "1 folder and 2 files" it will insert "1 folder" and "2 files" in place of both $texts in "$text and $text".


<string name="percent">$text%</string>

This string describes how to display percentages. It says that the number ($text) will go before a % symbol. If this is not appropriate in your language (for example, if you prefer to have the % before the number) you should change this string accordingly.


<string name="decimal">.</string> <string name="thousands">,</string>

These two strings describe what symbols to use to format numbers. If you don't use . to separate whole numbers from fractions or , to separate thousands-digits, you should change these strings to whatever your language uses.


<!-- How dates should be formatted (short and long forms). $m - The short month from the list above $M - The long month from the list above $n - The month, as a number $N - The month, always a two-digit number $d - The day of month $D - The day of month, always two digits $y - The two-digit year $Y - The four-digit year $w - The short weekday from the list above $W - The long weekday from the list above --> <string name="short-date">$m $d, $Y</string> <string name="long-date">$W, $M $d, $Y</string>

The short-date and long-date strings describe how to format dates for display. Every language does this differently, so you should adjust these strings accordingly.


<!-- Newbie info and contact info --> <string name="contact"> ... English translation by Sean Werkema &lt;seanw@sixty-five.cc&gt;[BR] </string>

If you're doing a foreign-language translation, you should be sure to put your name and e-mail address in the contact information so that people who find errors in the text know who to contact to get them fixed.

    
[ Prev: 2. The Basics | Up: Contents | Next: 4. Menus ]    

Copyright © 2006 by Sixty-Five, Inc. All Rights Reserved.