Translate a string to a language with masculin/feminine nouns

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.

Leave a Comment