Skip to content

Instantly share code, notes, and snippets.

@corsonr
Created May 31, 2012 13:03
Show Gist options
  • Save corsonr/2843297 to your computer and use it in GitHub Desktop.
Save corsonr/2843297 to your computer and use it in GitHub Desktop.
How to translate properly
// String with a variable
printf(__("This string contains %d words."), $count);
// string with many variables
printf(__('Your city is %1$s, and your zip code is %2$s.'), $city, $zipcode);
// plural / singular
printf(_n("We deleted %d spam message.", "We deleted %d spam messages.", $count), $count);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment