[wp-trac] [WordPress Trac] #35585: Support loading multiple languages to be loaded at the same time - rewrite the l10n to a class?

WordPress Trac noreply at wordpress.org
Sun Jan 24 21:35:54 UTC 2016


#35585: Support loading multiple languages to be loaded at the same time - rewrite
the l10n to a class?
--------------------------+------------------------------
 Reporter:  jongleur1983  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  I18N          |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by jongleur1983):

 Hi again,
 sorry for the delay but thanks for your response so far.

 @dd32 asked for my actual use case, so here it is:
 In my own blog I write posts in English and in German. With kind of a
 accessibility background (wrote my master thesis about accessibility for
 blind and visually impaired people) and a faible for clean code - in it's
 syntax as well as in it's semantics, writing blog posts in wordpress in
 different languages lacks proper lang="*" attributes in themes.

 Looking over the alternatives all I found was more than I needed and it
 misused the wordpress interna in some way I didn't like, so I started my
 own plugin (for more details about why and what I did, see my blog post
 http://www.jugglingsource.de/blog/simple-language-defined-posts-in-
 wordpress/ about it.

 One thing that I would like to make better now is the "read-more"-link.
 Blog posts are now correctly tagged with the right "lang" attribute using
 my post, even for different languages, but the "read more" always uses the
 language set in wordpress.

 I would like to use the language of the article it refers to as from a
 users perspective it is part of that article and therefore it should
 continue the text in the same language.

 On the other hand I would like to keep the plugin separate from any
 theming stuff, so I have to change the read-more generated by the
 wordpress api, and if the language of the post is available, I don't want
 to change how the current theme would generate it in that language.

 That's why it's not an option for me to include the corresponding strings
 in the plugin and use it language-independently.

 switch_to_locale() as mentioned by @SergeyBiryukov might be part of a
 solution here, yes - but if I imagine right how it would work, it might be
 a bad idea to switch the locale more than once while generating the same
 output page as it would have to switch for some strings and back again.
 The way it is described in #26511 would be supported by how I imagine it
 to work, but what I need - being able to control the language of some
 strings without having to switch the whole locale - should not be more
 expensive in terms of memory and runtime than the other way, but more
 flexible in what's possible.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35585#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list