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

List:       enlightenment-devel
Subject:    Re: [E-devel] E SVN: tasn trunk/elementary/src/lib
From:       Tom Hacohen <tom.hacohen () samsung ! com>
Date:       2013-07-23 9:47:34
Message-ID: 51EE5136.5030906 () samsung ! com
[Download RAW message or body]

Hey,

 From the setlocale man page:
"If locale is NULL, the current locale is only queried, not modified."

I am only querying it there, not modifying it. It's up to the 
application to set the locale to whatever it wants, for example by 
calling setlocale with "" like you've suggested.

This is *correct* don't change it. Look at ecrire for example, Ecrire 
does it right and works correctly.

--
Tom.

On 23/07/13 05:08, Daniel Juyung Seo wrote:
> Dear Tom,
> what does "if the app using elm is translatable." mean?
>
> With setlocale LC_MESSAGES to NULL, running applications with environment
> variable with LANG doesn't translate the texts.
>     const char *msg_locale = setlocale(LC_MESSAGES, NULL);
>
> I tried with "" instead of NULL and it worked.
>     const char *msg_locale = setlocale(LC_MESSAGES, "";
>
> Can you check this?
> Thanks.
>
> Daniel Juyung Seo (SeoZ)
>
>
> On Sun, Sep 18, 2011 at 4:53 PM, Enlightenment SVN <
> no-reply@enlightenment.org> wrote:
>
>> Log:
>> Elm gettext: Only translate if the app using elm is translatable.
>>
>>    It assumes gettext is initialized before the call to elm_init.
>>
>> Author:       tasn
>> Date:         2011-09-18 00:53:41 -0700 (Sun, 18 Sep 2011)
>> New Revision: 63452
>> Trac:         http://trac.enlightenment.org/e/changeset/63452
>>
>> Modified:
>>    trunk/elementary/src/lib/elm_config.c trunk/elementary/src/lib/elm_priv.h
>>
>> Modified: trunk/elementary/src/lib/elm_config.c
>> ===================================================================
>> --- trunk/elementary/src/lib/elm_config.c       2011-09-17 17:15:32 UTC
>> (rev 63451)
>> +++ trunk/elementary/src/lib/elm_config.c       2011-09-18 07:53:41 UTC
>> (rev 63452)
>> @@ -1658,12 +1658,33 @@
>>      _elm_rescale();
>>   }
>>
>> +static void
>> +_translation_init()
>> +{
>> +#ifdef ENABLE_NLS
>> +   const char *cur_dom = textdomain(NULL);
>> +   const char *trans_comment = gettext("");
>> +   const char *msg_locale = setlocale(LC_MESSAGES, NULL);
>> +
>> +   /* Same concept as what glib does:
>> +    * We shouldn't translate if there are no translations for the
>> +    * application in the current locale + domain. (Unless locale is
>> +    * en_/C where translating only parts of the interface make some
>> +    * sense).
>> +    */
>> +   _elm_config->translate = !(strcmp (cur_dom, "messages") &&
>> +         !*trans_comment && strncmp (msg_locale, "en_", 3) &&
>> +         strcmp (msg_locale, "C"));
>> +#endif
>> +}
>> +
>>   void
>>   _elm_config_init(void)
>>   {
>>      _desc_init();
>>      _profile_fetch_from_conf();
>>      _config_load();
>> +   _translation_init();
>>      _env_get();
>>      _config_apply();
>>      _elm_config_font_overlay_apply();
>>
>> Modified: trunk/elementary/src/lib/elm_priv.h
>> ===================================================================
>> --- trunk/elementary/src/lib/elm_priv.h 2011-09-17 17:15:32 UTC (rev 63451)
>> +++ trunk/elementary/src/lib/elm_priv.h 2011-09-18 07:53:41 UTC (rev 63452)
>> @@ -28,7 +28,7 @@
>>
>>   #ifdef ENABLE_NLS
>>   # include <libintl.h>
>> -# define E_(string) dgettext(PACKAGE, string)
>> +# define E_(string) _elm_dgettext(string)
>>   #else
>>   # define bindtextdomain(domain,dir)
>>   # define E_(string) (string)
>> @@ -148,6 +148,7 @@
>>
>>      /* Not part of the EET file */
>>      Eina_Bool      is_mirrored : 1;
>> +   Eina_Bool      translate : 1;
>>   };
>>
>>   struct _Elm_Module
>> @@ -247,6 +248,20 @@
>>   extern Eina_List   *_elm_win_list;
>>   extern int          _elm_win_deferred_free;
>>
>> +/* Our gettext wrapper, used to disable translation of elm if the app
>> + * is not translated. */
>> +static inline const char *
>> +_elm_dgettext(const char *string)
>> +{
>> +   if (EINA_UNLIKELY(_elm_config->translate == EINA_FALSE))
>> +     {
>> +        return string;
>> +     }
>> +
>> +   return dgettext(PACKAGE, string);
>> +}
>> +
>> +
>>   /* Used by the paste handler */
>>   void _elm_entry_entry_paste(Evas_Object *obj, const char *entry);
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
>> http://p.sf.net/sfu/rim-devcon-copy2
>> _______________________________________________
>> enlightenment-svn mailing list
>> enlightenment-svn@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

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