0

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?

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.

1

From WP developer page for Internationalization (https://developer.wordpress.org/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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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