Is it best practice to use English as the base of a translation-ready theme?

admin2025-06-03  2

If I make a theme and add hard-coded text using _e(), __(), esc_attr() and so on. Could I do this in polish (or whichever language) and then add English translation po/mo files with the other languages I want to include or is this backwards and bad practice?

If I make a theme and add hard-coded text using _e(), __(), esc_attr() and so on. Could I do this in polish (or whichever language) and then add English translation po/mo files with the other languages I want to include or is this backwards and bad practice?

Share Improve this question edited Feb 9, 2019 at 17:19 Krzysiek Dróżdż 25.6k9 gold badges53 silver badges74 bronze badges asked Feb 9, 2019 at 16:57 BootUpBootUp 251 silver badge5 bronze badges 1
  • esc_attr() has nothing to do with translations ;) – Krzysiek Dróżdż Commented Feb 9, 2019 at 17:19
Add a comment  | 

2 Answers 2

Reset to default 1

The default language of WordPress is always English (en-US). Regardless of what your site language is set to. This is what the entire WordPress community expects for the language of source strings, and how many translation projects for WordPress will be set up too.

So yes, it is bad practice to choose use different source language from the system you're writing for.

You could choose to ignore best practice, but with Polish you will run into a technical problem too. WordPress has a built-in limitation that you can only define two source forms of a pluralized string. This is actually a limitation of the gettext system, which is biased towards English. In their own words: "the coding standards for the GNU project require program being written in English". You could say the same of WordPress.

From WP developer page for Internationalization (https://developer.wordpress/themes/functionality/internationalization/):

Here are the best practices for writing strings • Use decent English style – minimize slang and abbreviations.

• Use entire sentences – in most languages, word order is different than English.

...

So yes - it’s a best practice to use English as base language and use translations for other languages.

And it makes sense - you write your code in English. So this way developers will be able to understand translated strings.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748919939a314824.html

最新回复(0)