[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: i18n questions
From:       Waldo Bastian <bastian () kde ! org>
Date:       2003-01-28 14:24:11
[Download RAW message or body]

On Tuesday 28 January 2003 12:47, Andras Mantia wrote:
> Hi,
>
> I experienced two not so common case in handling of internationalized
> strings.
>
> 1. In a dialog box created in QT Designer, I've added the elements to the
> listboxes. These elements appears in the generated files like
> tr2i18n( "bolder" ). But I do not want to translate them! Think about the
> situation when inserting the font weight in a CSS, and you can select the
> possible values from the listbox. If the texts are translated, the result
> will be in Italian something like:
> {
>         font-weight: Grassetto marcato;
> }
>
> Is there a way to tell that I don't want to translate those listbox
> elements (or revert the translation when I retrieve the currentText from
> the listbox), or the only solution is to add one by one the elements from
> code, without using i18n(...)?

I don't know if it is the only solution but it seels certainly the easiest 
solution, yes.

> 2. I would like to read some strings from external files. What is the
> recommended way to get those strings translated?
>   a)  use I18N_NOOP to tell that those strings should be translated and use
> i18n(QString_variable) in code (bad if the external files are from 3rd
> party) 

That's an option, but as you already state yourself, that only works if you 
know all possible strings. See also e.g. Makefile.am in KMail how it adds the 
texts from the "tips" file to the translation files.

> b) Read the translated strings from the external files (like in case
> of .desktop files). In this case how should it done? Read the correct
> string from the file by checking the current language of KDE and use the
> read string in code without i18n?

If the external files are in the format used by KConfig you can use:
key=some_string
key[de]=same_string_in_german
key[nl]=same_string_but_now_in_dutch
....

Then, if you use KConfig to read "key", it will automatically pick up the 
translated version according to the users language settings.

Note however that the translation framework used throughout KDE CVS might not 
pick up these string automatically (and as a result the KDE translators will 
not translate them) I'm not sure what the exact conditions are but I assume 
your filename must end with .desktop and "key" must be one of "Name" or 
"Comment". (This is only a concern if your application is being developed in 
KDE CVS)

Cheers,
Waldo
-- 
bastian@kde.org -=|[ SuSE, The Linux Desktop Experts ]|=- bastian@suse.com

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic