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

List:       kde-devel
Subject:    Re: i18n questions
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2003-01-28 13:30:52
[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(...)?

What I do not understand is why you want the strings untranslated despite 
being user visible. It seems to be against KDE translation policy. It would 
be to the I18N team to decide if they want to keep the CSS names or if they 
want to translate them. (Remember: many people in the world cannot read latin 
letters.)

The proper solution would to check the return result. For exasmple if the 
variable result has what the user has selected:

QString CSSProperty;
if (result==i18n("bolder"))
	CSSProperty="bolder";
else if (result==i18n("bold"))
	CSSProperty="bold";
// and so on

It might look as being boring code, but it would be i18n friendly.

>
> 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) 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?

Defining the string would not go with I18N_NOOP, as the strings are not in the 
C++ source file but somewhere else.

I think they are a few ways to do it correctly but currently I am not 
remembering the examples.

However using i18n for using the translated version is fine, for example:

kdDebug() << "Text:" << QString_variable << " Translation" << 
i18n(QString_variable.utf8()) << endl;

(QString_variable being a QString)

>
> Andras

Have a nice day/evening/night!
 
>> 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