Strings
From SqueezeboxWiki
Contents |
strings.txt guidelines
The Squeeze* family of software is using string.txt files to store localized text. These files are used in various places (Squeezebox Server, SqueezePlay, SqueezeTray), but follow the same simple conventions.
strings.txt files - Basic structure
- string files are saved as utf-8 encoded text files
- a string ID is an all uppercase, word character only string at the beginning of the line
- a string ID is followed by one or more localized strings
- localized strings use the form "[tab]LANG[tab]String]", where "[tab]" means a tab character, and "LANG" is the two letter language ID (http://en.wikipedia.org/wiki/List_of_ISO_639_codes)
- all whitespace lines are ignored
- a line starting with the hash character # is considered a comment and is ignored
Example:
# some comment - a first string IDSTRING_ID EN English version of line one FR Version française de la ligne une
Editing strings
If you want to edit Logitech Media Server strings, don't edit the strings.txt files directly. They will be overwritten with every update. Create your own custom strings file instead:
- create a file called custom-strings.txt in Logitech Media Server's server folder (where you'll find strings.txt)
- start Logitech Media Server with the additional --checkstrings parameter: this will tell it to re-read the strings files whenever they're changed. Using this parameter you should see string changes withing seconds on your player or (after a reload) on the web interface without restarting Logitech Media Server.
- add/edit strings as described above. Best copy the string token from the original strings.txt file and enter your translation.
- no need to create a custom-strings.txt file for all plugins etc. - one copy will do.
Editing SqueezePlay strings is a bit more complicated. You'd have to edit the strings.txt files on the Controller itself, using the SSH remote access. If you have to change strings of the main UI, you'll have to restart the Controller to see the changes happen. The file structure remains the same.
Submitting string changes to Logitech
Once you decide your changes should be included with the Logitech Media Server builds, pack your custom-strings.txt file in a .zip file and send it to michael at slimdevices dot com.
Advanced topics (devs only)
Addressing comments to the translators (SLT)
A comment can be addressed to SLT. This is useful if we eg. want to be sure that a string uses capitalization, doesn't exceed some length etc. The comment will then be included in the exchange file (see below) sent to SLT under the following conditions:
- these comments must start with the keyword "SLT"
- comments are only sent to SLT if they're after the string ID and before the next empty line
Example:
SHORT_STRING # SLT: Please keep the following strings shorter than 10 characters EN Short DE Kurz
Bad Examples:
#SLT Translators will never see this SHORT_STRING EN Short DE Kurz # NOTE SLT: this goes unseen ANOTHER_STRING EN Wow!
URLs in comments can be automatically turned into links for the translator's convenience by putting them inside double brackets:
# SLT: please see [[http://wiki.slimdevices.com/index.php?title=Strings§ion=6 ]]
SLT exchange file format
Strings are sent to SLT for localization in one file per language, called strings-LANG.txt (where "LANG" again is the language's two letter code). These files follow a different structure to allow for multiple module's files in one file to translate. The structure is as follows:
module__STRING_ID String comment
"module" defines the folder in which the strings.txt file is located. It's not the full path, but only the last folder name.
Example:
strings-EN.txt:
server__PLAYLIST Playlist server__SHUFFLE_PLAYLIST Playlist Please don't exceed 10 characters SomePlugin__PLUGIN_DESC Some Sample Plugin
strings-DE.txt:
server__PLAYLIST Wiedergabeliste server__SHUFFLE_PLAYLIST Liste Please don't exceed 10 characters SomePlugin__PLUGIN_DESC Ein Beispiel Plugin
"server" in this case defines the main strings.txt file, where "SomePlugin" is referring to eg. Slim/Plugin/SomePlugin. This method isn't fool proof, but simple and robust enough to just work.
The files should be named by the project, followed by the language and the extension .txt. Eg. "squeezenetwork-EN.txt".
A script to import/export this file format is available in the tools folder on Squeezebox Server trunk.