Skip to content
  • Ting-Wei Lan's avatar
    tests: Fix GDateTime format tests on non-English locales · a0c7f854
    Ting-Wei Lan authored and Philip Withnall's avatar Philip Withnall committed
    It seems that the test expects g_date_time_format to return formatted
    results in English, and there is no setlocale (LC_ALL, "") call in the
    file so the test does run in the default C locale. However, gettext
    seems to read the value of LC_MESSAGES from the environment by itself.
    Even if the value of LC_MESSAGES locale is C because of not calling
    setlocale, gettext still translates the name of the month according to
    the LC_MESSAGES environment variable, causing g_date_time_format_locale
    to fail on the "%b" test case because it cannot convert UTF-8 text
    returned by get_month_name_with_day to ASCII.
    
    To avoid the test failure, we set the LC_MESSAGES environment variable
    to C before format tests and restore it at the end of the function.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=795165
    a0c7f854