3

When developing an extension is there an reason other than simply "Best Practice" to include a en_US or extension base language translation file?

Example

I write an extension with some text where the default language is English. I then translate this to say German and Swedish so I obviously include these two as translation files but should I really include a "native" language file which would have an exact match of string and translation. e.g

"My cool text","My cool text"

Maybe this question may seem a bit like a personal opinion.

2 Answers 2

3

The only reason I see is to allow the extension users to change the texts.
So if they are not OK with

"My cool text","My cool text"

they can change it to

"My cool text","My text is cool"

I know this can be done even if the en_US file does not exist. Anyone can just create it, but it's nice to come with a default file.

Also, let's say that you deliver the extension with translations for German and Swedish.
But what if the one that downloads it does not speak either of those languages?

If the extension is for your personal use, you can skip this of course, but remember that in the future you might reuse is for (let's say) a French website. Then you can send the client the En file to translate.

If you have difficulties isolating the texts give this extension a try. Among other features, it will collect the translatable texts from your custom extension in one file.

2
  • A note on "But what if the one that downloads it does not speak either of those languages?" in my example I would still have the english in the code just not the translation file :) Commented Jan 28, 2015 at 11:12
  • 1
    @DavidManners. Yes, the texts are there, but it's not that easy to isolate if you don't know the code. Having them all in one file makes it easier to translate.
    – Marius
    Commented Jan 28, 2015 at 11:56
1

There is exactly no technical reason because Magento completely ignores translations where the original text equals the translated text (resulting in unexpected behavior if you want to change an english translation for one module but not for another, but that's another topic).

But it's a service for everybody who needs to translate your extension. Copying and modifying the english translation file is much easier than writing it from scratch. Of course, if you include translation in another language, one could copy this, but it's suboptimal.

Let's say I only want to translate it partially because I don't care if the backend is English... but i certainly cannot use it in Swedish. You get the point.

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.