1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How do I build a single language version of an Angular application localized with Angular i18n

Discussão em 'Angular' iniciado por Phil Jollans, Maio 31, 2025.

  1. Phil Jollans

    Phil Jollans Guest

    I am localizing an Angular application using the Angular i18n package.

    The original language is German, and I am creating an English version.

    On building the application, I get two subdirectories "de" and "en".

    Right now, I want to deploy an update to the original German version, in the original root directory on the server. In this case, I will have a problem with the tag <base href="/de/"> in index.html. Obviously, I can edit this tag by hand, but I'm not very happy with that solution.

    Is there a way to either

    • build the original language version into the root, and place the localized versions in subdirectories
      or
    • build a single language version into the root directory

    I have seen here that it is possible to specify the baseHRef for a language as "".

    "i18n": {
    "sourceLocale": "en",
    "locales": {
    "sv": {
    "translation": "src/i18n/messages.sv.xlf",
    "baseHref": ""
    },
    "da": {
    "translation": "src/i18n/messages.da.xlf",
    "baseHref": ""
    }
    }
    }


    Theoretically, that might help me, but it only seems to be possible for localized versions, and not for the "sourceLocale".

    Is there a way to specify the baseHref for the source language?

    In future, I might well register a separate domain name for the English version of my application. In that case, I might never use the default structure of subdirectories.

    Continue reading...

Compartilhe esta Página