From: <no...@so...> - 2002-12-28 09:04:33
|
Patches item #659311, was opened at 2002-12-28 09:04 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=303248&aid=659311&group_id=3248 Category: BZFlag Group: None Status: Open Resolution: None Priority: 5 Submitted By: Dave Brosius (dbrosius) Assigned to: Dave Brosius (dbrosius) Summary: i18n patch Initial Comment: THIS IS IN PROGRESS. IT WORKS BUT ALL THE STRINGS HAVEN'T BEEN EXTRACTED YET! This patch will allow BZFlag ot be played in multiple languages, by extracting out all the hardcoded strings in to resource bundles. A resource bundle is just a set of files that map string constants to localized strings. These files are organized through the use of locales. A locale is a description of a language from generic to specific and may contain three parts, language, country and dialect. So "en_US" describes english as spoken in the us "de" describes 'generic' german "en_US_l33t" describes l33t speak in us english :) For each locale, a separate dictionary file is required. BZflag will store these in the data/l10n directory, such as data/l10n/bzflag_en_US.l10n The contents is a simple key - value pair as in (DE) JoinGame Mitspielen When a user specifies that he would like to play in a certain dialect, like bzflag -locale es_ES bzflag will first look for a bzflag_es_ES file, and use these translations. In this case spanish as spoken in Spain. Not all the strings in BZFlag need to be represented in this file however, only those strings that are specific to es_ES. BZFlag will use bzflag_es.l10n to resolve any mappings not specified in bzflag_es_ES.l10n and will use bzflag.l10n to resolve any mappings not specified anywhere. The base bzflag.l10n are the primary english strings. If a locale isn't specified this is what is used. To Map strings two new classes found in common have been added BundleMgr.cxx and Bundle.cxx (along with headers in include) Using the BundleMgr you find (or create) the Bundle object that represents the language that you want to show. From there you can use the getLocalString method to get the translated version. For the BZFlag application, BundleMgr is stored in the World class. --- Phase II will be to have bzfs also use Resource bundles. A new network message will be added from client to server 'sl' (setlocale) which tells the server what the particular player's locale is. Older clients won't send this message, and the server will assume the default locale. The server will when sending messages to clients determine the locale for that client and localize the string before sending it. The bundle for the bzfs will start with bzfs, bzfs_en_US.l10n for example. Note that BZFlag only needs to load one bundle configuration, while BZFS will have to preload them all. --- Phase III will be to investigate adding Unicode support for multi-byte languages. As we are now using std::string this should be easy, except from a rendering point of view. This may be difficult --- Phase IV will be to translate player messages from src to destination language using babelfish... Ok, i'm kidding about step 4. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=303248&aid=659311&group_id=3248 |