|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: utility class |
|
15 * |
|
16 */ |
|
17 #include "cplanguagepluginutil.h" |
|
18 #include <QLocale> |
|
19 #include <hblocaleutil.h> |
|
20 #include "cplanguagepluginlog.h" |
|
21 #include <hbinputsettingproxy> |
|
22 |
|
23 QStringList CpLanguagePluginUtil::localizedLanguageNames(const QStringList &languageNames) |
|
24 { |
|
25 QStringList localizedLanguages; |
|
26 |
|
27 CPLANG_LOG("=================All languages======================="); |
|
28 foreach(const QString &language,languageNames) { |
|
29 CPLANG_LOG("Language: " + language + "\tLocalised:" + HbLocaleUtil::localisedLanguageName(language)); |
|
30 localizedLanguages << HbLocaleUtil::localisedLanguageName(language); |
|
31 } |
|
32 CPLANG_LOG("======================================================"); |
|
33 |
|
34 return localizedLanguages; |
|
35 } |
|
36 |
|
37 QStringList CpLanguagePluginUtil::localizedRegionNames(const QStringList ®ionNames) |
|
38 { |
|
39 QStringList localizedRegions; |
|
40 |
|
41 CPLANG_LOG("=================All regions======================="); |
|
42 foreach(const QString ®ion,regionNames) { |
|
43 CPLANG_LOG("Region: " + region + "\tLocalised:" + HbLocaleUtil::localisedRegionName(region)); |
|
44 localizedRegions << HbLocaleUtil::localisedRegionName(region); |
|
45 } |
|
46 CPLANG_LOG("==================================================="); |
|
47 return localizedRegions; |
|
48 } |
|
49 |
|
50 QStringList CpLanguagePluginUtil::localizedInputLanguageNames(const QList<HbInputLanguage> &inputLanguages) |
|
51 { |
|
52 QStringList localizedInputLanguages; |
|
53 |
|
54 CPLANG_LOG("=================All Input languages======================="); |
|
55 foreach (HbInputLanguage inputLanguage, inputLanguages) { |
|
56 CPLANG_LOG("Input language:" + inputLanguage.asString() + "\tLocalised:" + inputLanguage.localisedName()); |
|
57 if (inputLanguage == HbInputLanguage()) { |
|
58 localizedInputLanguages << hbTrId("txt_cp_setlabel_secondary_writing_language_val_non"); |
|
59 } |
|
60 else { |
|
61 localizedInputLanguages << inputLanguage.localisedName(); |
|
62 } |
|
63 } |
|
64 CPLANG_LOG("============================================================"); |
|
65 |
|
66 return localizedInputLanguages; |
|
67 } |
|
68 |
|
69 bool CpLanguagePluginUtil::isChineseVariant() |
|
70 { |
|
71 QStringList supportedLanguages = HbLocaleUtil::supportedLanguages(); |
|
72 foreach(const QString &language, supportedLanguages) { |
|
73 if (QLocale(language).language() == QLocale::Chinese) { |
|
74 CPLANG_LOG("Chinese Variant."); |
|
75 return true; |
|
76 } |
|
77 } |
|
78 return false; |
|
79 } |
|
80 |
|
81 //End of File |
|
82 |