[PATCH] KSpell2 improvement

Thiago Macieira thiago at kde.org
Mon Mar 13 14:21:54 GMT 2006


Mashrab Kuvatov wrote:
>> >One todo is left. One has to translate dictionary cryptic extension
>> > names into English and i18n'ify it. I have no idea how to do it.
>>
>> I'd recommend we use the form "Language (Region) Variant" for English
>> and construct it as
>> 	i18n("%1 (%2) %3").arg(i18n(language), i18n(region), i18n(variant))
>> so that translators get the chance to translate everything tokens.
>
>One doesn't need i18n for language and country. Like I said they are
> already translated.

True. That reduces it to:
  i18n("%1 (%2) %3").arg(language, country, i18n(variant));

>> Do not construct the strings like you did:
>> +              localizedDictionary += " (" + cISOName + ")";
>
>Why?

Because we don't know if the translators want to use something different 
than parentheses, or if they want to change the order of the items for 
their language.

As a rule of thumb, never construct strings by concatenating: use i18n() 
and QString::arg.

>> That means: extract all the extensions known to aspell into a file,
>> map them to an English name and mark them for translation.
>
>I've never done this so far and I don't know how the messages are
> extracted. If somebody helps me (Nicolas Goutte?), I'll try. Otherwise
> I leave it to experts.

"extract" means: find them all and construct a list like:

static const char *extensionList[2][] = {
  { "ise", I18N_NOOP("-ise suffixes") },
  { "ize", I18N_NOOP("-ize suffixes") },
  { "wo_accents", I18N_NOOP("without accents") },
  ...
};

>> >Would be nice to get it into stable (as it is there are no new
>> > messages). KWord and KPresenter users would appreciate it. By the
>> > way, one can do the same for dictionary selection combo in KWord's
>> > preferences for example.
>>
>> We're in feature-freeze. This is KDE 4 code...
>
>Personally, I don't take it as a feature. For me it is a bug and it is
> fixed without introducing any new messages.

It cannot be done without introducing new messages, unless you want to 
leave the "-wo_accent" cryptic variant names.

>> One other thing: you construct this map every time, including when the
>> language is changed. Please cache it somewhere in a variable to avoid
>> doing the expensive work whenever the user clicks the drop-down list.
>
>The method is called if the item in that drop-down list is changed. Just
>clicking will do nothing. Anyway, I didn't understand what you mean.
> Some code example would be better.

Exactly: the method is called every time an item is selected. And building 
this list is an expensive operation. Just save it in a variable the first 
time you're called.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

3. Ac seo woruld wearð geborod, swá se Scieppend cwæð "Gewurde Unix" and 
wundor fremede and him "Unix" genemned, þæt is se rihtendgesamnung.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060313/a6f608dc/attachment.sig>


More information about the kde-core-devel mailing list