German localization in XP (content types)

I know there is no german localization for XP yet,

  1. But I used german terms with umlauts in the i18n-files for my content-types.
    This is the result:

  1. Guillotine does not use the translation at all. I wanted to get the localized term for a content-type, but that did not work:


<content-type xmlns="urn:enonic:xp:model:1.0">
    <display-name i18n="glossary.displayName">Glossary</display-name>



 relations {
             contentType {             

result → Glossary, expected: Glossareintrag

Hi @luctho !

The problem with umlauts come from the encoding of your file. You have to change the encoding to be UTF-8.

I use IntelliJ, and this is where I configure it there:

Good luck with your project!

– Tom Arild


To answer your second question too:

You can overwrite the resolver of ContentType.displayName to get a localized version of it.
The i18n value is not surfaced by the api, so you have to find a way to lookup or generate the i18n-key.


  creationCallbacks: {
    ContentType: function(context, params) {
      const labels = {
        "myproject:article": "article.displayName",
        "myproject:glossary": "glossary.displayName",

      params.fields.displayName = {
        type: graphqlLib.GraphQLString,
        resolve: function(env) {
          return i18nLib.localize({
            key: labels[],

Maybe you could also create an issue in GuillotineLib to get this field localized as default.

– Tom Arild

Thanks- my mistake - I also use IntelliJ - when I checked encoding I had the focus in the wrong file :rage:

To my second question:
I see it is not a bug - it is a non existiing feature :wink:

Do you solve it in your projects with the suggested resolver ? And what about localization at the Next Frontend at all. Which library do you use ?

We’re not doing the frontend in Next JS. We’re using SvelteKit.

If you don’t need the locaization to come from the backend. Just use what is common for your frontend framework.

But if you want to read files, and create a json file for your frontend to use, you can modify and put the following task into your build.gradle and run the packI18nForJavaScript task:

import groovy.json.*

task packI18nForJavaScript {
  def webRootPath = "${rootDir}/../my-web-project"

  def destFile = new File("${webRootPath}/src/lib/phrases.ts")

  def nbPhrases = readProperties(
  def nnPhrases = readProperties(
  def enPhrases = readProperties(

  def builder = new JsonBuilder()
  builder {
    nb (
    nn (
    en (

  if (destFile.canWrite()) {
    def json = StringEscapeUtils.unescapeJavaScript(
        .replace('\\"', '`')
    ).replace('`', '\\"')

    destFile.write("export const phrases = $json\n")
    println("Updated \"${destFile.path}\"")
  } else {
    println("Can't write to \"${destFile.path}\"")

static def readProperties(file) {
  def props = new Properties();
  return props

@tom Thanks for sharing!

1 Like