Imported Upstream version 14.45.0
[platform/upstream/libzypp.git] / zypp / Locale.h
index d75ffd8..bcc46bc 100644 (file)
@@ -25,6 +25,9 @@
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
+  class Locale;
+  typedef std::tr1::unordered_set<Locale> LocaleSet;
+
   ///////////////////////////////////////////////////////////////////
   //
   //   CLASS NAME : Locale
@@ -83,6 +86,18 @@ namespace zypp
     /** Return a fallback locale for this locale, when giving up, returns empty Locale() */
     Locale fallback() const;
 
+  public:
+
+    /** Return the best match for \ref Locale \c requested_r within the available \c avLocales_r.
+     *
+     * If \c requested_r is nor specified or equals \ref Locale::noCode,
+     * \ref ZConfig::textLocale is assumed.
+     *
+     * If neither \c requested_r nor any of it's \ref fallback locales
+     * are available, \ref Locale::noCode is returned.
+    */
+    static Locale bestMatch( const LocaleSet & avLocales_r, const Locale & requested_r = Locale() );
+
   private:
     /** Pointer to implementation */
     RW_pointer<Impl> _pimpl;
@@ -122,10 +137,6 @@ namespace zypp
   }
   //@}
 
-  ///////////////////////////////////////////////////////////////////
-
-  typedef std::tr1::unordered_set<Locale> LocaleSet;
-
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////