[futurebasic] Re: [FB] Localize Beastie

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2001 : Group Archive : Group : All Groups

From: Alain Pastor <apastor@...>
Date: Sat, 07 Jul 2001 10:05:33 +0200
BMichael@... wrote:
> 
> >>From the architecture of "Backup Beastie", the simple FB 3 project backup
> >>helper, I hacked (I do mean hacked) together a mutated cousin that will go
> >>though a project, and grab from every file, anything within "quotes".
> >
> >  I might be showing my ignorance here but couldn't you dosomething with
> >it after it's been compiled. Isn't there an option in the compiler that
> >makes it put all of the strings into an STR# resource. Couldn't you then
> >just go through the resource translate them all and stick the new STR#
> >list in.
> 
> I'd like to once again plug "multiple-language" localizations. A standard
> feature of OS X, I've done this with FB and single resource files, as
> follows...
> 
> 1) Don't _put_ anything in quotes in your program source! Instead, keep
> ResEdit open to a STR# resource, and every time you start to put in
> quoted text, put it in a comment instead, following the resource # - like
> this:
> 
>   a$ = STR#(200,1)   'This is a test
>   b$ = STR#(200,2)   'This is only a test
> 
> Put the real text in STR# resource 200 at positions 1 & 2. If you fill
> STR#200, go on to STR#201, etc.. After compiling, you can look at the
> STR#s in the compiled application, and if FB has added any, you can
> decide to go back and 'fix' them, or possibly leave them alone as they
> aren't exposed to the user.
> 
> 2) When your program is "done" and tested, do a global replace on
> "STR#(200" with "STR#(gLanguage". "STR#(201" becomes "STR#(gLanguage+1".
> Set the global variable gLanguage to 200 in your startup and re-test.
> 
> 3) Add a preference (hidden or visible) or even a menu that will change
> gLanguage from 200 to 300. Copy STR#200 to STR#300. (Likewise 201, etc.)
> If you'll need more than two languages, repeat to STR#400.
> 
> 4) Name STR#200 "english", STR#300 "french", STR#400 "spanish", and so
> forth.
> 
> 5) Start translating - working in the STR# resources 300 and up! When
> you've got a language done, make the preference or menu option visible to
> the end users instead of just you, and you've now got a bilingual (or
> multilingual) program.
> 

The problem with Bill's approach, if I have understood correctly, is
that your final app will be bigger in size including that feature
which will not be very often used by the end-users I believe. (I
think Jonathan will jump here advocating the .nib file approach for
the same purpose). However, there is an advantage also doing the
things like Bill: the designer of the app (i.e. you) is immediately
confronted to the problems the localizers usually have to solve
(length of strings in dialog boxes, different constructs for
sentences, difficulties in translating local expressions or jokes to
name what comes to mind). In a certain way, with Bill's technique,
you can keep the control of the final aspect of your app in all the
languages you have decided to handle.

> (See "Mr. Hex In Louisiana" or "GWorld Tutor" for programs I've done
> which use this technique - although I've never managed to get anyone to
> localize either one for me, and I have enough trouble with English...)
> 
GWorld Tutor (on the CD) includes the Italian and French versions
and it works great as far as I know. For bigger projects, I'm not
sure that Bill's technique would make the things easier.

> Now - if you've already written the program without using this method,
> you'll have to re-localize it every time you change something and
> recompile. In which case "Localize Beastie" may well be much faster than
> slogging through ResEdit.
> 
Personally, I use two tools for the localization of the FB^3 IDE
namely PowerGlot and LiteralGlot (I think Michele uses AppleGlot and LiteralGlot).
PowerGlot is a very cool app for localizers although from time to
time we have to fix manually minor problems. PowerGlot builds a
database with the common resources it can find in your original app,
then you work on that database doing your localization work and when
you're done you generate a localized version in one click (well
ideally. In practice this is rarely the case 'cos generally there
are more resources to edit, like PICTs for example which are not
handled by the software). Dealing with new releases of the original
app is a breeze (or it should be), because you just have to edit the
parts that have been changed from the previous version.
LiteralGlot is a little FB^3 prog written by Michele and I that
helps us more than a lot for the localization of the FB^3 headers.
It extracts the quoted strings in the set of source files you want
to translate and builds resulting files. For each file generated,
you must write a corresponding file with the localized words or
sentences, then you run again the program and it does all the
replacements for you. That part used to be a pain for us before
LiteralGlot, now it is a joke.
-- 

Cheers

Alain

-----------------------------------------------------
FB^3 in Europe:  http://euro.futurebasic.com/
FB II Pouch:     http://www.pixmix.com/FB/outils.html
-----------------------------------------------------