on xenial help sign in
Select correct Chinese input method for OSK in the wizard (LP: #1588633)
commitd8ebc066236f6c190dff668937fa851cf5001270 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateFri 17 Jun 2016, 01:17 (10 years ago) parent86b4284ef2cf6c
2 files changed+20−6
qml/Wizard/Pages/10-welcome.qml+17−4 tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/MockLanguagePlugin.qml+3−2
qml/Wizard/Pages/10-welcome.qml+17−4
@@ -61,6 +61,21 @@ LocalComponents.Page {
6161 }
6262 }
6363
64+ function applyOSKSettings(locale) {
65+ var language = locale.split("_")[0].split(".")[0];
66+ var oskLanguage = language;
67+
68+ if (language === "zh") { // special case for Chinese, select either simplified or traditional
69+ if (locale.substr(0, 5) === "zh_CN" || locale.substr(0,5) === "zh_SG") {
70+ oskLanguage = "zh-hans"; // Chinese Simplified
71+ } else {
72+ oskLanguage = "zh-hant"; // Chinese Traditional
73+ }
74+ }
75+
76+ oskPlugin.setCurrentLayout(oskLanguage);
77+ }
78+
6479 // splash screen (this has to be on the first page)
6580 Image {
6681 id: splashImage
@@ -158,9 +173,8 @@ LocalComponents.Page {
158173 onClicked: {
159174 if (plugin.currentLanguage !== languagesListView.currentIndex) {
160175 var locale = plugin.languageCodes[languagesListView.currentIndex];
161− var language = locale.split("_")[0].split(".")[0];
162176 plugin.currentLanguage = languagesListView.currentIndex;
163− oskPlugin.setCurrentLayout(language);
177+ applyOSKSettings(locale);
164178 System.updateSessionLocale(locale);
165179 }
166180 i18n.language = plugin.languageCodes[plugin.currentLanguage]; // re-notify of change after above call (for qlocale change)
@@ -169,8 +183,7 @@ LocalComponents.Page {
169183 (root.simManager0.present && root.simManager0.ready) || (root.simManager1.present && root.simManager1.ready) ||
170184 root.seenSIMPage) { // go to next page
171185 pageStack.next();
172− }
173− else {
186+ } else {
174187 pageStack.load(Qt.resolvedUrl("sim.qml")); // show the SIM page
175188 }
176189 }
tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/MockLanguagePlugin.qml+3−2
@@ -17,7 +17,8 @@
1717import QtQuick 2.4
1818
1919Item {
20− property var languageNames: ["English (United States)", "French (France)", "Spanish (Spain)"]
21− property var languageCodes: ["en_US", "fr_FR", "es_ES"]
20+ property var languageNames: ["English (United States)", "French (France)", "Spanish (Spain)", "Spanish (Mexico)",
21+ "German (Switzerland)", "Czech (Czechia)", "Chinese (Hongkong)", "Chinese (Singapore)", "Chinese (China)"]
22+ property var languageCodes: ["en_US", "fr_FR", "es_ES", "es_MX", "de_CH", "cs_CZ", "zh_HK", "zh_SG", "zh_CN"]
2223 property int currentLanguage: 0
2324}