Jump to page content
English English   Polish Polish   Dutch Dutch   Russian Russian   German German   Hungarian Hungarian   Norwegian Norwegian   Swedish Swedish   Finnish Finnish   Romanian Romanian   Spanish Spanish   Portuguese Portuguese   Latvian Latvian  
Homepage
Home
Register
Login

Resources
Forum
Wiki
Servers

rssRodeggo translator (rodeggo)

Category:misc
Author(s):LordAzamath
Downloads:413
Rate:You need to be logged in to vote
Rating:4.3 (3 Votes)
Description:
0. Simplified using
- Add strings to 'definitions.xml' to each language with an identifyier (see the examples there and don't forget to set the resource right)
- Inside other resources use 'strings = exports.rodeggo.importStrings()'
- now you can use strings.identifyier and it returns the string in the client's language
- the client can change the language with '/setlang identifyier'
- you can change clients language with 'exports.rodeggo.setLanguage(identifyier)'


1. Description
- This resource is meant for gamemode managers for translation purposes. It makes it easy for example to have help files in multiple languages without needing to script them yourself.
- You can also also script GUI or whatever really to be multilingual
- It's client side only on purpose, the language differs between clients but the server shouldn't differentiate between players. Serverside outputChatBox outputs for every client, so you'd need to loop them etc.
- Clients can set their language with '/setlang LANGCODE', where langcode is defined in 'definitions.xml' as one of the mentioned languages
- Other resources need to add 'strings = exports.rodeggo:importStrings()' before using this. Then you can just address them with 'strings.STRINGID', where STRINGID is the identifyer at 'definitions.xml' '<string>' tag.
2. Definitions
- All string definitions are at 'definitions.xml'
- In order to add a new language, all you need to do is add an '<lang name="LANGCODE"></lang>'
2.1 <lang/> tag
- name: language identificator used in /setlang
- You don't have to translate every string you have at ENG, it just looks at ENG if it doesn't find the string at LANGCODE.
2.2 <string/> tag
- name: The identificator of the string, used in strings.IDENTIFICATOR
- resource: the resource the string belongs to. You can always import strings of another resource, but it doesn't make sense to import them all. So by default it exports the strings belonging to the caller resource. See 'exported functions' for further reference
- the value of the xml tag is the translated string
3. Exported functions and commands
- All functions/commands here are client side.
3.1 function 'table importStrings([string resourcename])'
- returns a table full of strings which belong to the resource. I added the resourcename argument because it's a waste of memory to load all strings that are in the definitions file into memory for all resources. So it only imports those which have the resource name in their <string/> tag.
3.2 function 'bool setLanguage(LANGCODE)'
- sets and saves the client's default language to LANGCODE
- LANGCODE is the language identifyier at 'definitions.xml'
3.3 command 'setlang LANGCODE'
- sets and saves the client's default language to LANGCODE
- LANGCODE is the language identifyier at 'definitions.xml'
4. Internal workings
- At the start of the resource the script loads the currently saved language from clientside xml and then loads all English strings into a table (well actually the first <lang/> tag strings). If the language is not ENG, then it overloads all strings that are in the saved language definitions. So when a language doesn't have for example GUI_WELCOMEMESSAGE translation, it doesn't overwrite the ENG one and always returns the ENG one instead.
5. Report bugs at http://forum.multitheftauto.com/viewtopic.php?t=28241
...

(more)

Download latest version | Report

Version history

Version Publish Date Changes
0.1.1 2010-07-04 16:04:38 A typo in a function call made the /setlang command not work. Download
0.1.0 2010-07-04 10:43:39 First public release Download