GSAK (Geocaching Swiss Army Knife) | ||
Contents
- Index
GetSil(sEnglish,[sForm],[sSection],[sLanguage]) : string You would normally use this function in macros to translate English text to the current language using the GSAK translation master. For the full background on GSAK translations please see this thread The function gives you complete access to the translations stored in the language.sil master (located in the GSAK install folder). One of the issues with writing macros is that sometimes they might test for a particular string (see example below), and currently this string will always be in English. The problem here is that test will fail when the user has selected a language other than English. This function has been added to help address such issues. sEnglish - This is the English version of the string contents being translated. This is equivalent to the text you see in the "English" column when you view the translation master in the SIL editor. However, there may be times when it is more convenient to reference the actual ID rather than the English string. For example, you want to get the translated string for the English message with the id of "Message114". Rather than have to enter the exact English text for this message, it much easier if you could just reference it by it's ID. To use the ID, prefix your sEnglish string with "MsgId:". So if you wanted the translation for Message114 then the string to pass would be "MsgId:Message114". Any translation in the .sil master can be referenced by the ID rather than the full English text (though your macro code probably self documents better if you use the English text). sForm - Optional, default is "" (empty string). You normally wouldn't need this parameter. It should be remembered that both the English text and the ID are not unique in this database. You could have the exact same text or ID in two different forms. However, if they are the same then it is most likely that the translation is exactly the same. However, because of the context of the form there is the possibility that translations may be different. By using the sForm parameter, your force this function to use the translation associated with that form. Other wise the function just grabs the first matching translation. sSection - Optional, default is "Strings". Usually it is the [Strings] section in the SIL file that you want this function to grab the translation from. However, there may be times when you need the translation from another section. For example, you are writing a macro that uses a "Cancel" button and you want it to look exactly like the GSAK cancel button and also support translations. In this case you would use "Captions", as all buttons are translated in the [Captions] section Language - Optional, default is "Current". The return value of this function is the translated text in the current language as per the user's settings. However, there may be times when you would like to force the return text to be in a specific language (perhaps for testing or debugging). The language names for this parameter can be one of: English German French Dutch Danish Czech Swedish Norwegian Italian Hungarian Example, when writing a Custom HTML format we want to remove "Driving directions" link. Before GSAK supported multiple languages, the code would be:
The problem here is that this won't work for all languages. With this function we can alter the code to ensure it works, regardless of the language setting.
Also see the related command MakeTranslation Alpha List Category List |
Copyright 2004-2019 CWE Computer Services Privacy Policy Contact |