Bug 356239 - Only system languages can be selected as collection languages
Summary: Only system languages can be selected as collection languages
Status: RESOLVED FIXED
Alias: None
Product: parley
Classification: Applications
Component: editor (show other bugs)
Version: unspecified
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: parley bug tracker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-03 11:50 UTC by Dimitris Kardarakos
Modified: 2016-02-23 14:10 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitris Kardarakos 2015-12-03 11:50:34 UTC
When I try to create a new collection, in the popup dialog, in "Languages" group, in fields "First Language", "Second Language" only system installed languages can be selected. 
E.g. If I set:
$export LANGUAGE=el:en_US:es:de
and open parley, then I will be able to select Greek, American English, Spanish and German.
In a quite possible setup having only English installed, only english can be selected.

Reproducible: Always

Steps to Reproduce:
1. Open Parley 
2. Click "Create a New Collection"
3. Select values of "First Language", "Second Language" 

Actual Results:  
Only system installed languages are selectable

Expected Results:  
Any language should be selected (e.g. as in Parley 1.0.0)

Parley Version: 2.1.0
Comment 1 Dimitris Kardarakos 2016-02-15 09:46:22 UTC
In https://git.reviewboard.kde.org/r/127063/ you may find a possible solution approach to the issue. I add it here as well so as to facilitate better tracking of the issue.
Comment 2 sven 2016-02-18 23:21:40 UTC
Hello Dimitris,
I'm happy that you fixed it. Do you know, when the fix will be uploaded in https://github.com/KDE/parley/ ?
CU Sven
Comment 3 Dimitris Kardarakos 2016-02-19 09:46:01 UTC
Hi Sven,

the patch is under review by kdeedu group in git.reviewboard.kde.org. As soon as review is completed and patch is submitted, since (AFAIK) https://github.com/KDE/parley/ is a read only mirror of https://projects.kde.org/, it will be present there and ready to be compiled.

Thanks.
Comment 4 Dimitris Kardarakos 2016-02-23 14:10:37 UTC
Git commit 6efe4ae84f6c3fbeca8a7a4ecf243669221dc5f1 by Dimitris Kardarakos.
Committed on 23/02/2016 at 14:08.
Pushed by dkardarakos into branch 'master'.

Fix Bug 356239 and facilitate proper grammar downloading

After porting to frameworks, only languages from the currently installed language packages can be selected when creating a new collection.
Moreover, grammar fetching does not work in some cases even if the grammar file exists in http://edu.kde.org/parley/locale/.
Instead of using QLocale().uiLanguages() in order to create the combobox of to-be-selected languages, a key map has been created with
key = language-country, value = locale. Now, user is presented with a list of Language (Country) entries. After selecting, the locale
(value of the key map) is set to the data part of the combobox. So, the looping in uiLanguages() in DocumentProperties::acceptLanguageConfiguration
can be avoided. uiLanguages() returns an ordered list of locale names like "en-Latn-US", "en-US", "en". E.g., in case of american english,
en-US is set. Trying to fetch the grammar from http://edu.kde.org/parley/locale/, although en.kvtml exists, we cannot get the grammar.
With this fix, locale info is stored as a string of the form "language_country" (using QLocal name() function). When trying to fetch grammar,
only the first part (language) is used. Thus, de.kvtml, en.kvtml, es.kvtml, fr.kvtml can now be properly downloaded.

REVIEW: 127063

M  +1    -1    src/collection/collection.cpp
M  +1    -1    src/parleydocument.cpp
M  +31   -18   src/settings/documentproperties.cpp
M  +6    -0    src/settings/documentproperties.h
M  +3    -7    src/settings/languagepropertiespage.cpp

http://commits.kde.org/parley/6efe4ae84f6c3fbeca8a7a4ecf243669221dc5f1