[theme-reviewers] Some questions about theme translation

Dion Hulse (dd32) wordpress at dd32.id.au
Thu Nov 17 03:14:26 UTC 2011


Correct.. It's not really designed for Ajax comment submission at present,
however, what you can do is:

Submit via Ajax to wp-comments-post.php
Add a hook early in the process to define a new wp_die() handler so as to
output the wp_die messages in a Ajax-friendly way (only when your custom
"This is a ajax request var is set of course)
Hook in later on 'comment_post_redirect' to return the Ajax "Everythings
submitted ok!" status (You'll want to die so it doesn't redirect there)

That'll cause all comment submission to be handled "normally" so you
shouldn't have plugin conflicts as well.

See also:
http://core.trac.wordpress.org/ticket/18630
http://core.trac.wordpress.org/ticket/16979

On 17 November 2011 14:02, Justice <justice360 at gmail.com> wrote:

> My original intention is for those return values from AJAX requests. For
> example, when I submit an empty comment, I'll get the error message "Error:
> please type a comment". It's from the core pot file. When I submit the same
> empty comment via AJAX, I may expect that same error message. If I always
> use the theme translation, once the core translation change, they'll be
> inconsistent. But if the original string changes, the inconsistency will be
> inevitable. I think there's no perfect sollution because WordPress is just
> not designed to work with AJAX.
>
>
> On Thu, Nov 17, 2011 at 9:54 AM, Dion Hulse (dd32) <wordpress at dd32.id.au>wrote:
>
>> That's a lot of extra work for little benefit.
>>
>> Just include the string as a translatable item in your pot file, that way
>> your users will always get a translated string if it exists for them.
>>
>> What you suggested was basically "Use cores translated text, otherwise
>> use my translated text, otherwise, use the english text"  seems if
>> anything, you'd want to do theme > core > english.
>>
>> D
>>
>> 2011/11/17 Justice <justice360 at gmail.com>
>>
>>> That makes sense. Thanks.
>>> I have another idea to deal with this situation: I can check if the core
>>> language pack provides a non-empty translation that is different to the
>>> original string and if not, the translation will fallback to that from the
>>> theme text domain. Is that feasible?
>>>
>>> Justice
>>>
>>> 在 2011-11-16,下午11:08,Chip Bennett <chip at chipbennett.net> 写道:
>>>
>>>  I don't think using "twentyten" or "twentyeleven" text strings will
>>> *ever* work, because if a different Theme is active, then *that Theme's*
>>> textdomain will be loaded, and the twentyten/twentyeleven textdomains will
>>> NOT be loaded.
>>>
>>> On the question of core: there is no guarantee that the core text
>>> strings will never change. If the strings are provided by your Theme, then
>>> *your Theme* needs to provide the translation for those strings.
>>>
>>> Chip
>>>
>>> On Wed, Nov 16, 2011 at 8:59 AM, Edward Caissie <
>>> edward.caissie at gmail.com> wrote:
>>>
>>>> Although I may not be well versed in i18n implementation, the correct
>>>> method for a theme in the repository to support it is to have all text
>>>> strings visible to the end-user be translatable via the theme's language
>>>> files thus requiring the textdomain to be included with each instance where
>>>> an i18n function is used ... even if the code is directly copied and pasted
>>>> from core.
>>>>
>>>> One cannot assume the text strings being translated will always be
>>>> available as expected if they are not included with the Theme itself. As
>>>> with the examples of using the `twentyten` or `twentyeleven` domains, the
>>>> theme author cannot expect they will always be available as it is possible
>>>> some end-users may choose to remove all themes except for their active one.
>>>>
>>>>
>>>> Cais.
>>>>
>>>>
>>>>
>>>> On Wed, Nov 16, 2011 at 9:46 AM, Rick Anderson <rick at byobwebsite.com>wrote:
>>>>
>>>>> I'm interested in this as well.  I recently reviewed a theme that had
>>>>> some missing text domains, some were using twentyten and others were using
>>>>> twentyeleven.  I read the section where themes are "required" to provide
>>>>> their theme slug as the text domain.
>>>>>
>>>>> On Tue, Nov 15, 2011 at 11:09 PM, Justice <justice360 at gmail.com>wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I reused some WordPress core code for AJAX support in my theme so
>>>>>> there are some missing text domains when outputing traslatable strings. One
>>>>>> reviewer told me that it is required to provide translation in my own
>>>>>> language pack for all translatable strings appear in my theme. Actually I
>>>>>> left that blank by intention because I'd like to use the same wording as
>>>>>> the core language packs of WordPress, eg. Name, Email, Error: please type a
>>>>>> comment, etc.
>>>>>> Can anybody tell me why themes can't share the core language pack?
>>>>>>
>>>>>> Thanks for hard working!
>>>>>>
>>>>>> ---------------
>>>>>> Best regards
>>>>>> Justice
>>>>>>
>>>>>> _______________________________________________
>>>>>> theme-reviewers mailing list
>>>>>> theme-reviewers at lists.wordpress.org
>>>>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Rick Anderson*
>>>>> *WordPress Trainer/Web Developer*
>>>>> www.byobwebsite.com
>>>>> 935 Daley Street
>>>>> Edmonds, WA 98020
>>>>> (206) 801-5209
>>>>> Skype - tailoringtheweb
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> theme-reviewers mailing list
>>>>> theme-reviewers at lists.wordpress.org
>>>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> theme-reviewers mailing list
>>>> theme-reviewers at lists.wordpress.org
>>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>>
>>>>
>>> _______________________________________________
>>> theme-reviewers mailing list
>>> theme-reviewers at lists.wordpress.org
>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>
>>>
>>> _______________________________________________
>>> theme-reviewers mailing list
>>> theme-reviewers at lists.wordpress.org
>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>
>>>
>>
>> _______________________________________________
>> theme-reviewers mailing list
>> theme-reviewers at lists.wordpress.org
>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>
>>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20111117/40553f81/attachment.htm>


More information about the theme-reviewers mailing list