cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with i18n Configuration in SAP CAP: Only Translates to the Base Language

PabloCastano
Discoverer
0 Kudos
151

Hi everyone,

I’m developing a backend with SAP CAP, and I’m facing an issue with the configuration of i18n files. My application is only using translations from the base i18n.properties file (English), but it’s not loading translations from the i18n_es.properties file for Spanish.

Here are the details of what I’ve checked so far:

  1. i18n Files:

    • I have the base i18n.properties file with English texts.
    • I’ve also created the i18n_es.properties file with translations into Spanish.
    • Both files are located in a folder named _i18n, which I’ve placed in the root directory of the project.
  2. Accept-Language Header:

    • In the HTTP requests, I’m sending the Accept-Language header as es,en-US;q=0.9,en;q=0.8.
    • I’ve verified that the value of req._locale is 'es,en-US;q=0.9,en;q=0.8', which indicates that es should be the preferred language.
  3. package.json Configuration:

    • I’ve tried adding the following configuration to set the default language:
      "cds": { "i18n": { "default_language": "es" } }

Despite all this, the application still only uses the translations from the i18n.properties file and doesn’t pick up the Spanish translations.

Questions:

  1. Is there any additional configuration needed in SAP CAP to recognize and use language-specific files like i18n_es.properties?
  2. Could there be an issue with how CAP determines the language based on req._locale?

I would greatly appreciate any advice or solutions to make my backend recognize and use Spanish translations.

Thanks in advance!

Accepted Solutions (0)

Answers (0)