[wp-hackers] Plugins using post types with localization
Dion Hulse (dd32)
wordpress at dd32.id.au
Mon Jul 4 04:32:58 UTC 2011
I'm surprised no-one pointed this out straight away... It's something I've
accidentally done before, infact, It looks like Log Deprecated Calls may
even have this problem too
You're registering your post types before you're telling WordPress to load
your translations. You need to load your translations before registering the
post type/taxonomies.
Furthermore, You should really not be running any of that code before the
init action IMO.. The only core functions you should call before init are
add_action() and add_filter()
You may want to add a priority to your items as well, for example:
add_action('init', 'myplugin_load_translations', 1);
add_action('init', 'myplugin_various_items', 10/* default is 10*/);
And while i'm at it, Do you really need to handle back-compat with old
versions of WordPress using WP_PLUGINS_URL etc? You shouldn't even be using
those constants anymore, and instead using plugins_url() (eg: $url =
plugins_url('css/myfile.css', __FILE__); )
D
On 4 July 2011 14:23, Diana K. Cury <dianakac at gmail.com> wrote:
> No, nada here. :(
> Contextual help, added pages etc works ok, but editing screens, even panel
> itens don't change. Thats bad, some people want translate it but I must wanr
> them about this not working.
>
> Should I post in p2 blog Ze?!
>
>
> ----- Original Message ----- From: "José Fontainhas" <
> jfontainhas at gmail.com>
> To: <wp-hackers at lists.automattic.com>
> Sent: Sunday, July 03, 2011 8:11 PM
>
> Subject: Re: [wp-hackers] Plugins using post types with localization
>
>
> Also, this issue is *definitely* a discussion for the polyglots' P2
>
> 2011/7/4 José Fontainhas <jfontainhas at gmail.com>:
>
>> Try
>>
>> load_plugin_textdomain('ADA', false, dirname( plugin_basename(
>> __FILE__ ) ) . '/lang' );
>>
>> instead of
>>
>> load_plugin_textdomain('ADA', null, dirname( plugin_basename( __FILE__
>> ) ) . '/lang' );
>>
>>
>>
>>
>> On 3 July 2011 23:53, Diana K. Cury <dianakac at gmail.com> wrote:
>>
>>> Not sure which deprecated log plugin you are talking about. I'm talking
>>> about this one
>>> http://wordpress.org/extend/plugins/log-deprecated-notices/
>>> made by Nacin Last Updated: 2011-2-9.
>>>
>>> Line 134 says:
>>> load_plugin_textdomain('log-deprecated', null, dirname( plugin_basename(
>>> __FILE__ ) ) . '/languages/' );
>>>
>>> Mine (http://wordpress.org/extend/plugins/ada-plugin/) has everything
>>> i18n,
>>> but the translations never reach the post type screen. Contextual Help
>>> works, but the labels in edit screen, no, nada.
>>>
>>>
>>> ----- Original Message ----- From: "José Fontainhas" <
>>> jfontainhas at gmail.com>
>>> To: <wp-hackers at lists.automattic.com>
>>> Sent: Sunday, July 03, 2011 7:35 PM
>>> Subject: Re: [wp-hackers] Plugins using post types with localization
>>>
>>>
>>> Also, AFAICT, the Log Deprecated plugin isn't loading a textdomain at
>>> all, nor are its calls to __(), _e(), et al, using one. It doesn't
>>> even have a .pot file (although it's easy enough to create one).
>>>
>>> -- Z
>>>
>>> 2011/7/3 José Fontainhas <jfontainhas at gmail.com>:
>>>
>>>>
>>>> Not sure I get the question fully, or if it should be discussed on the
>>>> polyglot's blog[1], but the way bbPress (plugin) does it is the way
>>>> any well behaved plugin should, i.e. it loads a language file for its
>>>> own textdomain[2], uses internationalized strings with that
>>>> textdomain[3], which can be translated from a .pot file, specific to
>>>> that plugin.
>>>>
>>>> If, on the other hand, those custom post types are being defined by a
>>>> theme's functions.php file, the process is only different in that the
>>>> file should load the textdomain for the *theme* [4], and said theme
>>>> should have its own .pot file.
>>>>
>>>> In short, individual custom post types are not a part of core and
>>>> hence those strings do not exist on core's .pot files
>>>>
>>>> -- Zé
>>>>
>>>> [1] http://wppolyglots.wordpress.com
>>>> [2]
>>>> http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
>>>> [3]
>>>>
>>>> http://codex.wordpress.org/I18n_for_WordPress_Developers#Translatable_strings
>>>> [4] http://codex.wordpress.org/Function_Reference/load_theme_textdomain
>>>>
>>>>
>>>>
>>>>
>>>> On 3 July 2011 22:58, Diana K. Cury <dianakac at gmail.com> wrote:
>>>>
>>>>>
>>>>> Hi Andrew,
>>>>>
>>>>> I'm using your plugin for know how to handle post types, but it seems
>>>>> is
>>>>> unable to get the translations in post screens too. I see there are
>>>>> some
>>>>> mods for not show some aspects, etc but I tried in remaining buttons
>>>>> and
>>>>> labels around and the translation just don't reach anything. If I
>>>>> change
>>>>> your code for display a whole editing screen, translation still doesn't
>>>>> work.
>>>>>
>>>>> I'm waiting for bbPress to see how this is handled there.
>>>>>
>>>>> ----- Original Message ----- From: "Andrew Nacin" <wp at andrewnacin.com>
>>>>> To: <wp-hackers at lists.automattic.com>
>>>>> Sent: Sunday, July 03, 2011 3:01 PM
>>>>> Subject: Re: [wp-hackers] Plugins using post types with localization
>>>>>
>>>>>
>>>>> On Sun, Jul 3, 2011 at 1:11 PM, Diana K. Cury <dianakac at gmail.com>
>>>>> wrote:
>>>>>
>>>>> Hello there,
>>>>>>
>>>>>> Someone could suggest me a plugin tha uses post types with working
>>>>>> localization? I still can´t find a solution for this issue: post type
>>>>>> screens aren't reached by the translation on plugins. Even the Log
>>>>>> Deprecated has this problem.
>>>>>>
>>>>>
>>>>>
>>>>> How so?
>>>>> _______________________________________________
>>>>> wp-hackers mailing list
>>>>> wp-hackers at lists.automattic.com
>>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>> _______________________________________________
>>>>> wp-hackers mailing list
>>>>> wp-hackers at lists.automattic.com
>>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>>
>>>>>
>>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>>
>> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list