Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.

Commit message:
Now checking to see if dynamic context's lang is supported.

Requested reviews:
  Paul J. Lucas (paul-lucas)

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/155143

Now checking to see if dynamic context's lang is supported.
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/155143
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/durations_dates_times/format_dateTime.cpp'
--- src/runtime/durations_dates_times/format_dateTime.cpp	2013-03-23 00:02:16 +0000
+++ src/runtime/durations_dates_times/format_dateTime.cpp	2013-03-24 15:23:24 +0000
@@ -1182,6 +1182,14 @@
       // language defined in the dynamic context.
       //
       planState.theLocalDynCtx->get_locale( &lang, &country );
+      if ( !locale::is_supported( lang, country ) ) {
+        //
+        // If the language defined in the dynamic context isn't supported
+        // either, try the host's language and hope for the best.
+        //
+        lang = locale::get_host_lang();
+        lang_is_fallback = true;
+      }
     }
 
     char component;

=== modified file 'src/zorbautils/locale.h'
--- src/zorbautils/locale.h	2013-03-17 16:27:54 +0000
+++ src/zorbautils/locale.h	2013-03-24 15:23:24 +0000
@@ -297,8 +297,8 @@
     }
 
     /**
-     * Gets the date format for the current locale.  The format is that used by
-     * strptime(3).
+     * Gets the date format in the locale specified by the given language and
+     * country.  The format is that used by \c strptime(3).
      *
      * @param lang The language to use.  Defaults to host language.
      * @param country The country to use.  Defaults to host country.
@@ -308,8 +308,8 @@
                              iso3166_1::type country = iso3166_1::unknown );
 
     /**
-     * Gets the date and time format for the current locale.  The format is
-     * that used by strptime(3).
+     * Gets the date and time format in the locale specified by the given
+     * language and country.  The format is that used by \c strptime(3).
      *
      * @param lang The language to use.  Defaults to host language.
      * @param country The country to use.  Defaults to host country.
@@ -333,7 +333,8 @@
     iso639_1::type get_host_lang();
 
     /**
-     * Gets a month's abbreviation in the current locale.
+     * Gets a month's abbreviation in the locale specified by the given
+     * language and country.
      *
      * @param month_index The index of the month to get in the range 0-11.
      * @param lang The language to use.  Defaults to host language.
@@ -345,7 +346,8 @@
                             iso3166_1::type country = iso3166_1::unknown );
 
     /**
-     * Gets a month's full name in the current locale.
+     * Gets a month's full name in the locale specified by the given language
+     * and country.
      *
      * @param month_index The index of the month to get in the range 0-11.
      * @param lang The language to use.  Defaults to host language.
@@ -357,7 +359,8 @@
                             iso3166_1::type country = iso3166_1::unknown );
 
     /**
-     * Gets the time AM or PM string in the current locale.
+     * Gets the time AM or PM string in the locale specified by the given
+     * language and country.
      *
      * @param pm If \c true, gets the PM string; else the AM string.
      * @param lang The language to use.  Defaults to host language.
@@ -368,8 +371,8 @@
                            iso3166_1::type country = iso3166_1::unknown );
 
     /**
-     * Gets the time format for the current locale.  The format is that used by
-     * strptime(3).
+     * Gets the time format in the locale specified by the given language and
+     * country.  The format is that used by \c strptime(3).
      *
      * @param lang The language to use.  Defaults to host language.
      * @param country The country to use.  Defaults to host country.
@@ -379,7 +382,8 @@
                              iso3166_1::type country = iso3166_1::unknown );
 
     /**
-     * Gets a weekday's abbreviation in the current locale.
+     * Gets a weekday's abbreviation in the locale specified by the given
+     * language and country.
      *
      * @param day_index The index of the weekday to get in the range 0-6.
      * @param lang The language to use.  Defaults to host language.
@@ -391,7 +395,8 @@
                               iso3166_1::type country = iso3166_1::unknown );
 
     /**
-     * Gets a weekday's full name in the current locale.
+     * Gets a weekday's full name in the locale specified by the given language
+     * and country.
      *
      * @param day_index The index of the month to get in the range 0-6.
      * @param lang The language to use.  Defaults to host language.
@@ -403,7 +408,8 @@
                               iso3166_1::type country = iso3166_1::unknown );
 
     /**
-     * Checks if the given locale is supported by the OS.
+     * Checks if the locale specified by the given language and country is
+     * supported by the OS.
      *
      * @param lang The language to use.
      * @param country The country to use.  Defaults to none.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to