Localization in packages

Hi!

I am in the midst of porting my Umbraco 13 packages into Umbraco 17. As I’ve been studying a bit of Japanese. I was thinking it would be good practice to add Japanese translations! But this got me thinking a bit. Regarding the cultures. In most cases there are multiple. e.g:

  • en, en-us & en-gb
  • sv & sv-se
  • ja & ja-jp

I’ve come across I can do something like this too add my own localization.

{
      "type": "localization",
      "alias": "MyPackage.Localize.EnUS",
      "name": "English (United States)",
      "meta": {
        "culture": "en-us"
      },
      "js": "/App_Plugins/my-package/Localization/en-us.js"
},

But, I am getting a bit confused here. Do I need add this for all available cultures? like 1 for en, 1 for en-us and 1 for en-gb (pointing at the same file)? Or do I just add for 1? My thinking here is. If I add only for ja. The ones with ja-jp won’t get the translations?

Or what’s the general idea here?

You can add the non-regionalised localisations, and all regions will fall back to that one.

ja-jp => ja

en-us => en
en-gb => en

Unless you have specific variables for a region, this is the way to go, so change your code to:

{
      "type": "localization",
      "alias": "MyPackage.Localize.En",
      "name": "English",
      "meta": {
        "culture": "en" // <-- only "en"
      },
      "js": "/App_Plugins/my-package/Localization/en.js" // <-- Might as well rename the file to "en.js"
},

Hello Jacob!

Thank you so much for your answer!

Just double checking here so there’s no ambiguity.

So if en-us is selected. But only en exists. It will fallback to en? Or in my case if ja-jp is selected, but only **ja**exists, It will fallback to ja.

Right?

Correct :blush:

Thank you so Jacob! You’re a rock star!

H5YR :raising_hands:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.