[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdecore
From:       John Layt <john () layt ! net>
Date:       2010-11-10 1:35:09
Message-ID: 20101110013509.0FEA0AC89E () svn ! kde ! org
[Download RAW message or body]

SVN commit 1194866 by jlayt:

Improve the new installed languages api after discussion with dfaure

Change name from allLanguagesInstalledList() to a more natural
installedLanguages().  Oh the indignity of having one's English corrected by
a Frenchman :-)

Move the en_US entry.desktop file from kdebase/kcontrol/locale/default to a
more logical and obvious kdelibs/kdecore/localization.  This means the revised
unit test will also always work.  Move the all_languages.desktop there as well.

The kdebase delete will follow shortly.

And while I'm there, fix the problem steveire found with KLocale constructor
being too fussy about the case of the country code and lack of documentation
for it.



 M  +2 -1      CMakeLists.txt  
 D             all_languages.desktop   [TRAILING SPACE]
 A             localization/all_languages.desktop   all_languages.desktop#1194770 \
[TRAILING SPACE]  A             localization/entry.desktop   \
trunk/KDE/kdebase/runtime/kcontrol/locale/default/entry.desktop#1192086  M  +2 -2     \
localization/klocale.cpp    M  +7 -4      localization/klocale.h  
 M  +3 -3      localization/klocale_kde.cpp  
 M  +1 -1      localization/klocale_p.h  
 M  +1 -1      tests/klocaletest.cpp  


--- trunk/KDE/kdelibs/kdecore/CMakeLists.txt #1194865:1194866
@@ -462,7 +462,7 @@
 
 ########### next target ###############
 
-configure_file(all_languages.desktop ${CMAKE_CURRENT_BINARY_DIR}/all_languages \
@ONLY) +configure_file(localization/all_languages.desktop \
${CMAKE_CURRENT_BINARY_DIR}/all_languages @ONLY)  
 kde4_add_executable(kde4-config NOGUI kde-config.cpp )
 
@@ -518,6 +518,7 @@
 
 ########### install files ###############
 install( FILES ${CMAKE_CURRENT_BINARY_DIR}/all_languages DESTINATION \
${LOCALE_INSTALL_DIR}  ) +install( FILES localization/entry.desktop  DESTINATION  \
${LOCALE_INSTALL_DIR}/en_US )  install( FILES kdebug.areas kdebugrc DESTINATION \
${CONFIG_INSTALL_DIR} )  install( FILES
    kdecore_export.h
--- trunk/KDE/kdelibs/kdecore/localization/klocale.cpp #1194865:1194866
@@ -677,9 +677,9 @@
     return d->allLanguagesList();
 }
 
-QStringList KLocale::allLanguagesInstalledList() const
+QStringList KLocale::installedLanguages() const
 {
-    return d->allLanguagesInstalledList();
+    return d->installedLanguages();
 }
 
 QString KLocale::languageCodeToName(const QString &language) const
--- trunk/KDE/kdelibs/kdecore/localization/klocale.h #1194865:1194866
@@ -98,8 +98,8 @@
      * country of this locale.
      *
      * @param catalog  the name of the main language file
-     * @param language the language for the locale
-     * @param country  the country for the locale
+     * @param language the ISO Language Code for the locale, e.g. "en" for English
+     * @param country  the ISO Country Code for the locale, e.g. "us" for USA
      * @param config   a configuration file with a Locale group detailing
      *                 locale-related preferences (such as date and time
      *                 formatting options)
@@ -1844,10 +1844,13 @@
      * @return list of all language codes
      *
      * @see languageCodeToName
+     * @see installedLanguages
      */
     QStringList allLanguagesList() const;
 
     /**
+     * @since 4.6
+     *
      * Provides list of all installed KDE Language Translations.
      *
      * Use languageCodeToName(language) to get human readable, localized
@@ -1857,7 +1860,7 @@
      *
      * @see languageCodeToName
      */
-    QStringList allLanguagesInstalledList() const;
+    QStringList installedLanguages() const;
 
     /**
      * Convert a known language code to a human readable, localized form.
@@ -1873,7 +1876,7 @@
      * @see language
      * @see languageList
      * @see allLanguagesList
-     * @see allLanguagesInstalledList
+     * @see installedLanguages
      */
     QString languageCodeToName(const QString &language) const;
 
--- trunk/KDE/kdelibs/kdecore/localization/klocale_kde.cpp #1194865:1194866
@@ -104,8 +104,8 @@
 KLocalePrivate::KLocalePrivate(KLocale *q_ptr, const QString &catalog, KConfig \
                *config,
                                const QString &language, const QString &country )
                : q(q_ptr),
-                 m_country(country),
-                 m_language(language),
+                 m_country(country.toLower()),
+                 m_language(language.toLower()),
                  m_languages(0),
                  m_catalogName(catalog),
                  m_calendar(0),
@@ -2682,7 +2682,7 @@
     return m_languages->groupList();
 }
 
-QStringList KLocalePrivate::allLanguagesInstalledList()
+QStringList KLocalePrivate::installedLanguages()
 {
     QStringList languages;
     QStringList paths = KGlobal::dirs()->findAllResources("locale", \
                QLatin1String("*/entry.desktop"));
--- trunk/KDE/kdelibs/kdecore/localization/klocale_p.h #1194865:1194866
@@ -213,7 +213,7 @@
      * @internal Returns a list of all installed KDE languages.
      * The worker of the same-name KLocale API function.
      */
-    virtual QStringList allLanguagesInstalledList();
+    virtual QStringList installedLanguages();
 
     /**
      * @internal Returns the name of the internal language.
--- trunk/KDE/kdelibs/kdecore/tests/klocaletest.cpp #1194865:1194866
@@ -42,7 +42,7 @@
 
 void KLocaleTest::languages()
 {
-    kDebug() << KGlobal::locale()->allLanguagesInstalledList();
+    QVERIFY(KGlobal::locale()->installedLanguages().contains("en_US"));
 }
 
 void


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic