Unable to migrate backoffice localization from Dictionary to extension due to format

Hello,

I currently have a few sites running Umbraco 13 that I want to migrate to Umbraco 17. For these sites, I am using Dictionary items to translate the Umbraco backoffice. I do know that going forward, this has to be done with extensions.

The problem with that is that our current Dictionary-Key format looks like this:
DocumentType
DocumentType.button
DocumentType.button.color

As far as I can tell from the documentation and tests, this format is not supported. Here is what I tried (there are duplicates to show what I’ve already tried):

{
  "name": "Document Type Localization",
  "extensions": [
    {
      "type": "localization",
      "alias": "DocumentType.Localize.En",
      "name": "English",
      "meta": {
        "culture": "en",
        "localizations": {
          // my format: doesn't work
          "DocumentType": "Document type",
          "DocumentType.button": "Button",
          "DocumentType.button.color": "Color",

          // my format with _: doesn't work
          "DocumentType": "Document type",
          "DocumentType_button": "Button",
          "DocumentType_button_color": "Color",

          // expected format: can't translate DocumentType itself
          "DocumentType": {
            "button": "Button"
          },
        }
      }
    }
  ]
}

I had hoped that “DocumentType.xx.xx” works, but it doesn’t. I also tried updating all the “. “ to “_ “ in the database and use DocumentType_xx_xx, but this doesn’t work either. And for the expected format, you can’t translate the parent itself.

Do you have any suggestions? Maybe I am missing something and my format can somehow work? Or do you have any tips going forward how I can fix this issue without having to manually rename 200+ Dictionary items for several sites?

I think the only option is something like this:

"localizations": {
  "DocumentType": {
    "label": "Document type",
    "button": {
      "label": "Button",
      "color": "Color"
    }
  }
}

Which will produce keys like this:

  • DocumentType_label → “Document type”
  • DocumentType_button_label → “Button”
  • DocumentType_button_color → “Color”

I don’t think underscores and dots are going to work.

Or you might need to flatten it like this:

"localizations": {
  "DocumentType": "Document type",
  "DocumentTypeButton": "Button",
  "DocumentTypeButtonColor": "Color",
}

Thank you for the suggestions. After additional testing and reading more documentation, I don’t think either option works.

The localizations are applied by using the syntax #{area alias}_{key alias}.

It seems to force this specific format: “something_something”, which means you have to have a parent (without translation, e.g. “DocumentType”) with children only one level deep.
Your first example goes 2 levels deep with children and the second example is missing the parent/child structure. I couldn’t get either to work except with the specific format from the documentation.

Not sure if it’s a bug or intended.

If it’s intended then the only remaining option would be “Something_sub1”, “Something_sub1-sub2”, also mentioned in the documentation.

Even though the backend has changed so it no longer can apply dictionary items to texts, there is really no reason why the frontend cannot be aware of dictionary items converted TO localization keys instead.

It triggered something in me, and I’ve tried to build a package around it, which is available on Nuget here:

It is not 100% compatible with the old Backoffice - you need to add curly brackets to trigger the new localization system, and you cannot use “root” keys anymore (you must have an area and a key).

I tried to outline the differences here: umbraco-lexicon/docs/migration.md at main · iOvergaard/umbraco-lexicon · GitHub

Perhaps something like this can help you.