Bug 245417

Summary: wrong language fallback
Product: [Applications] konversation Reporter: kavol <kavol>
Component: generalAssignee: Konversation Developers <konversation-devel>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, caslav.ilic, hein
Priority: NOR    
Version: 1.3.1   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 4.6.0
Sentry Crash Report:
Attachments: SystemSettings window
kcmshell4 language
Switch Application Language in Konversation

Description kavol 2010-07-22 11:10:26 UTC
Version:           1.3.1 (using Devel) 
OS:                Linux

My system language is set to Czech (and nothing else), both via locale (cs_CZ.UTF-8) and via SystemSettings ('Český').

But it seems that Czech translation of Konversation was dropped in between 1.2 and 1.3

What happens now is that I see half of the text in Konversation in Russian instead of untranslated (= in English) if Czech is not available.

If I try to use the Switch Application Language function, the configuration window shows
Primary Language: Chinese (China)
Fallback Language: Russian
Fallback Language: English (USA)

(The language names are in Russian/Cyrillic, see bug #245411.)

I really don't know where this setting comes from, and it is NOT obeyed, as Chinese is listed as primary but the texts are mix of Russian and English. Only after clicking OK and restarting the application, the texts change to Chinese (wonderful ... unlike Cyrillic, I really cannot read Chinese characters ...)

Trying to remove the [Language] section from konversationrc (in between quiting and starting the application again) leads only to the same as before, mixing Russian (which comes out of nowhere) with English text.

Note also, that even after clicking OK to the above configuration, i.e. Chinese as primary and Russian and English as secondary, under [Language] in konversationrc there is only zh_CN, no mention of ru and en as secondary languages.

Reproducible: Didn't try
Comment 1 Eike Hein 2010-07-22 11:24:24 UTC
It's not handled in Konversation ...

Albert, could you chime in / reassing this to the correct product and component?
Comment 2 kavol 2010-07-22 12:37:44 UTC
(In reply to comment #1)
> It's not handled in Konversation ...

ok, I thought so, but it is the only application that showed me such behaviour
Comment 3 Albert Astals Cid 2010-07-22 21:54:41 UTC
I am not sure i understand what your problem is, can you try to reparaphrase it in a more structured and concise way?
Comment 4 kavol 2010-07-23 08:59:58 UTC
(In reply to comment #3)
> I am not sure i understand what your problem is, can you try to reparaphrase it
> in a more structured and concise way?

the main problem is that Konversation partly speaks Russian to me while I have not chosen to use Russian

please ask specific questions what is unclear to you that can be answered simply, English is not my native language and I'm afraid I cannot express better
Comment 5 Albert Astals Cid 2010-07-23 23:02:55 UTC
What does "kcmshell4 language" show?
Comment 6 kavol 2010-07-27 16:16:07 UTC
(In reply to comment #5)
> What does "kcmshell4 language" show?

within the list of languages, it shows three items

1. Český (Czech)
2. (empty line)
3. Americká angličtina (American English)

quite interesting, because if I open the language settings in SystemSettings, there is only one line "Český"
Comment 7 Chusslove Illich 2010-07-27 21:44:36 UTC
What is written in section [Locale] in file ~/.kde/share/config/kdeglobals?
What is written in the same section in ~/.kde/share/config/konversationrc (if the section exists)?
Comment 8 kavol 2010-07-29 13:27:25 UTC
(In reply to comment #7)
> What is written in section [Locale] in file ~/.kde/share/config/kdeglobals?

[Locale]
Country=cz
CurrencySymbol=K č
Language=cs:ru:en_US
ThousandsSeparator=$0 $0

interesting ... so 'ru' is there (I just did not know where to look) - but it is NOT displayed in systemsettings (as well as en_US) - why if the command "kcmshell4 language" while apparently displaying the same configuration dialogue as systemsettings, shows three entries as they are in kdeglobals?

now it starts making sense ... but I'm really not sure where 'ru' came from, I have NOT installed Russian locales

$ rpm -qa | grep kde-l10n
kde-l10n-4.4.5-2.fc13.noarch
kde-l10n-Czech-4.4.5-2.fc13.noarch

so it does not appear in the selection (well, the untranslated English name should be there instead of the empty line ...)

but konversation has its own localisation file:

$ rpm -ql konversation | grep ru
/usr/share/locale/ru/LC_MESSAGES/konversation.mo

so that after not finding Czech locales, it falls back to Russian, following the settings in kdeglobals, and then to English for the strings missing in Russian

> What is written in the same section in ~/.kde/share/config/konversationrc (if
> the section exists)?

no, it does not exist, I've removed it alltogether to get the defaults


---
ok, so now it is obvious that there is a misconfiguration on my system, 'ru' (and 'en_US') should not be in Language= in kdeglobals

but still, there are three bugs:

1) SystemSettings do not show the full contents of Language= in kdeglobals, not allowing me to remove the superfluous language (and not giving me a clue where the problem lies)

2) "kcmshell4 language" shows empty line for the Russian language

3) 'Switch Application Language' dialogue shows settings that do not correspond to what is actually set
Comment 9 kavol 2010-07-29 13:33:15 UTC
Created attachment 49630 [details]
SystemSettings window

1) SystemSettings do not show the full contents of Language= in kdeglobals, not
allowing me to remove the superfluous language (and not giving me a clue where
the problem lies)
Comment 10 kavol 2010-07-29 13:33:55 UTC
Created attachment 49631 [details]
kcmshell4 language

2) "kcmshell4 language" shows empty line for the Russian language
Comment 11 kavol 2010-07-29 13:37:13 UTC
Created attachment 49632 [details]
Switch Application Language in Konversation

3) 'Switch Application Language' dialogue shows settings that do not correspond
to what is actually set

(the Primary Language is Chinese instead of Czech)

(in addition, the fallback languages are from the global settings, while I'd expect the dialogue to show the local settings for the application, i.e. all the languages empty, as nothing is set within konversationrc ... if global settings are to be shown, there should be some note whether the displayed setting is global or local)
Comment 12 Chusslove Illich 2010-07-29 14:22:44 UTC
I have no idea how ru found its way into the global configuration file, if
not by someone sometime putting it there. Perhaps in a previous installation
of the system, which had Russian installed too?

I think that the problem with empty line in kcmshell4 language is that the
base Russian translation files for KDE are not installed, and yet the
language is found in configuration file. To verify this, check whether the
following two files exist on your system:

  /usr/share/locale/ru/entry.desktop
  /usr/share/locale/ru/LC_MESSAGES/kdelibs4.mo

If not (expected), could you actually install Russian language package and
check if it is now normally displayed in kcmshell4 language? If this all
checks out, we should see how to handle "unknown" languages wrt. current
installation.

As for the application showing global language setting if its own is not
set, without any indication of the globality, I agree that this is not very
nice. It is a consequence of default configuration behavior, which is
cascading: no [Locale] section in application's configuration file, hence
the global one is fetched. I don't know how this could be implemented
technically (i.e. detect whether the setting is own or global, indicate in
UI if global).
Comment 13 kavol 2010-07-29 17:04:39 UTC
(In reply to comment #12)
> I have no idea how ru found its way into the global configuration file, if
> not by someone sometime putting it there. Perhaps in a previous installation
> of the system, which had Russian installed too?

really don't know, yes, it is possible that I had Russian installed & enabled in the (far) past ...

> I think that the problem with empty line in kcmshell4 language is that the
> base Russian translation files for KDE are not installed, and yet the
> language is found in configuration file. To verify this, check whether the
> following two files exist on your system:
> 
>   /usr/share/locale/ru/entry.desktop
>   /usr/share/locale/ru/LC_MESSAGES/kdelibs4.mo
> 
> If not (expected),

yes, they are not there:
$ LANG=en ls /usr/share/locale/ru/entry.desktop /usr/share/locale/ru/LC_MESSAGES/kdelibs4.mo
ls: cannot access /usr/share/locale/ru/entry.desktop: No such file or directory
ls: cannot access /usr/share/locale/ru/LC_MESSAGES/kdelibs4.mo: No such file or directory

> could you actually install Russian language package and
> check if it is now normally displayed in kcmshell4 language?

yes, after installing kde-l10n-Russian it says "Ruský"

> If this all
> checks out, we should see how to handle "unknown" languages wrt. current
> installation.

... just to take the string from "all_languages" file?

> As for the application showing global language setting if its own is not
> set, without any indication of the globality, I agree that this is not very
> nice. It is a consequence of default configuration behavior, which is
> cascading: no [Locale] section in application's configuration file, hence
> the global one is fetched. I don't know how this could be implemented
> technically (i.e. detect whether the setting is own or global, indicate in
> UI if global).

well, now I guess this has more to do with another report, bug #230108 ...
Comment 14 Chusslove Illich 2010-07-29 22:08:45 UTC
>> [: Chusslove Illich :]
>> [...] we should see how to handle "unknown" languages wrt. current
>> installation.
>
> [: kavol :]
> ... just to take the string from "all_languages" file?

I think we should rather eradicate the unknown language. This means that if
base files of language X are not installed, then 1) its translations should
not be used when an application installed its own catalog in that language,
2) it should not be shown in language settings, and 3) it should be removed
_from the configuration file when the user changes language settings.
Comment 15 Albert Astals Cid 2010-09-27 01:17:53 UTC
I've commited two fixes that should fix this problem.

The first is a change to the locale kcm that will remove any language that can't be found (like russian in your case) warning the user about it.

The second is a bugfix in the 'Switch Application Language' that prevents weird things from happening when one of the languages from your global language list has no translation for this particular program.

This fixes will show up in KDE 4.6.0
Comment 16 Eike Hein 2010-09-27 03:20:14 UTC
Thanks Albert :).