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

List:       kde-devel
Subject:    Re: Translation (i18n) question
From:       Stephan Kulow <coolo () kde ! org>
Date:       2002-02-27 15:58:23
[Download RAW message or body]

On Wednesday 27 February 2002 16:43, mh wrote:
> Hans Petter Bieker, Mittwoch, 27. Februar 2002 13:24:
> > On Sat, 23 Feb 2002, mh wrote:
> > > is it possible to load a catalogue (*.mo), which is not located in KDEs
> > > standard location?
> > > I.e. if I know the absolute path /some_path/bla.mo, is it then possible
> > > to load this file through KLocale?
> > > The only function I could find is insertCatalogue(), but it seems, that
> > > this function assumes, that the catalogue is located in KDEs "locale" -
> > > dir. Or shorter: Is there something like QTranslator::load() for
> > > KLocale?
> >
> > No. Why do you need it? Perhaps you can use KCatalogue directly.
>
> Because I need to access the translation supplied by another library
> (libsane). Stephan Kulow already pointed out, that this can be done with
> KGlobal::dirs()->addResourceDir() and KLocal::insertCatalouge().
> However, as I wrote in a followup, the translated strings aren't displayed
> correctly (missing "Umlaute" or vowel mutations). I thought (without
> knowing much about KDEs i18n framework), that this is due to the fact, that
> the .po files are not utf8 encoded.
> I did some additional tests:
> 1.If I use bindtextdomain() and textdomain() and then
> QString translated_string = gettext(untranslated_char_string)
> it works without problems.
>
> 2. If I use my own .mo file loader in conjunction with QTranslator, it
> seems to work too:
> QString qs = translated_char_string_from_mo_file;
> QString qs2 = QString::fromUtf8(qs);
> qs2 = QString(qs2.utf8());
> QString translated_string_for_translator;
> if(qs == qs2)
>   translated_string_for_translator = QString::fromUtf8(qs);
> else
>   translated_string_for_translator = qs.local8Bit();
> QTranslator trans.insert(QTranslatorMessage(scope,original_char_string,
>                                       translated_string_for_translator));
>
> So why doesn't this work with KLocal::insertCatalouge() ? As far as I can
> tell, KDE simply uses libintl ported to C++ (kdecore/libintl.cpp).
> And more important, how should I proceed now?
> Anyone, please...
>
Encode your PO files in UTF-8

Greetings, Stephan

-- 
life is too short to make mistakes

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