9

So in english we don't have gendered nouns. It is always "a table" or "a desk" with no need to worry about it being "une table" or "un tableau" (french). So my question is that when working on the french .mo file, how does one translate a string such as :

You can include a %s in a childtheme

since the "a" depends on what the %s is?

2 Answers 2

7

This is not a problem if every string gets its own template for translation.

If you use the string You can include a %s in a childtheme. more than one time for different nouns it is not translatable.

An example, taken from a recent article: New %s is in German (yes, we have gendered nouns too) …

  • Neues Buch (for a book, neutral)
  • Neuer Film (for a movie, masculine)

… so you have to write New book and New movie or You can include a logo in a child theme. and You can include a stylesheet in a child theme..

Side note

That’s one of the reasons why translation files take so much memory: You have to “repeat” many very similar strings. While a WordPress installation in English will probably run fine with 32MB PHP memory it will just die if you use the same with a German or French translation.

If your theme or plugin is using many translatable strings for front-end and back-end consider using two files: one for the back-end and a separate file for the front-end.

load_theme_textdomain( 
    'your_text_domain', 
    get_template_directory() . '/languages' . ( is_admin() ? '/backend' : '/frontend' )
);

The WordPress core just changed to this system for better performance.

8
  • thanks toscho. i guess i need to dig deeper into the purpose of the original string and see what %s is being used for. how do i separate the back-end and front-end strings? Commented Jun 14, 2012 at 12:04
  • @helgatheviking see my update.
    – fuxia
    Commented Jun 14, 2012 at 12:10
  • gotcha. thanks for that. one more thing, if the string is only used once, can you leave it with %s and just provide clarification of context? Commented Jun 14, 2012 at 12:23
  • @helgatheviking Yes, you do that. But I don’t see how this would make translation easier. The context parameter has to be a hard coded string too; you cannot use a PHP variable here.
    – fuxia
    Commented Jun 14, 2012 at 12:47
  • "yes, we have gendered nouns too" remembers me of Mark Twain: Whenever the literary German dives into a sentence, that is the last you are going to see of him till he emerges on the other side of his Atlantic with a verb in his mouth.
    – brasofilo
    Commented Jun 14, 2012 at 13:02
0

Helga, you Viking... I'd say this is one dam of a simple and intriguing question..!

In a simple view, looks like the issue is the %s and not the gender:

You can include %s in a child theme

Complexifying the matter, I donnow if a gettext toscho's retranslate wizardry would address this, or if it is off-topic and should be taken care of by WP Polyglots.

side note: How-to: Translate plural forms for themes/plugins with PoEdit

2
  • phew, this translation stuff is complicated. clearly i take being a native-anglophone for granted! if this thread would be better at WP Polyglots I hope someone will move it. Commented Jun 14, 2012 at 12:02
  • Well, now, au contraire, with the canonical answer provided by toscho, WP Polyglots may use this post as reference for the subject :)
    – brasofilo
    Commented Jun 14, 2012 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.