Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portal does not display Cyrillic characters when adding translations to i18n #2602

Open
nosbuka opened this issue Oct 11, 2023 · 3 comments
Open
Labels
Needs Sponsorship Sponsor Apiman's developers to implement this feature S: Triage T: Bug

Comments

@nosbuka
Copy link

nosbuka commented Oct 11, 2023

Apiman Version

3.2.1.Final

Apiman Manager Distro

WildFly

Apiman Gateway Distro

Vert.x

Java Version

openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+13)
OpenJDK 64-Bit Server VM (build 14.0.2+13, mixed mode, sharing)

Operating System

CentOS Linux release 7.8.2003

Are you running Apiman in a container, or on an orchestration platform?

No (Bare Metal)

Describe the bug

I'm trying to customize developer portal by adding assets/i18n/ru.json file with some Cyrillic translations and assets/config-java.json5 with links having Cyrillic names (to the footer).

When I tried to check /portal/home url, all Cyrillic text became something like "?????????".
I checked Network tab in browser and found that server responds with "????" symbols instead of Cyrillic. Both of requests:

  • /portal/assets/i18n/ru.json
  • /portal/assets/config-java.json5

responds with Content-Type header equal to application/json;charset=ISO-8859-1.

Here is an examples of files.
a part of ru.json

  {
    "COMMON": {
      "OKAY": "ОК",
      "CANCEL": "Отмена",
      "YES": "Да",
      "NO": "Нет",
      "SEARCH": "Найти или создать",
      "CREATE": "Создать",
      "NEXT": "Далее",
      "BACK": "Назад",
      "FINISH": "Завершить",
      "ORGANIZATION": "Организация",
      "CLIENT": "Клиент",
      "NO_DATA_FOUND": "Не найдено данных",
      "CONFIRM": "Подтвердить",
      "SIGNUP": "Войти",
      "HOME": "Домой",
      "QUERY_PARAMETER": "В качестве HTTP Query Parameter",
      "HTTP_HEADER": "В качестве HTTP Request Header",
      "API_DOCS": "API Documentation",
      "ERROR": "Не удалось загрузить данные. Попробуйте позднее.",
      "SUCCESS": "Успешно создано.",
      "LOGIN": "Логин",
      "LOGIN_OR_REGISTER": "Войти / Зарегистрироваться",
      "LOGOUT": "Выйти",
      "VERSION": "Версия",
      "OF": "of",
      "AGREEMENT": "Соглашение"
     }
}

That server responds like:

{
  "COMMON": {
    "OKAY": "??",
    "CANCEL": "??????",
    "YES": "??",
    "NO": "???",
    "SEARCH": "????? ??? ???????",
    "CREATE": "???????",
    "NEXT": "?????",
    "BACK": "?????",
    "FINISH": "?????????",
    "ORGANIZATION": "???????????",
    "CLIENT": "??????",
    "NO_DATA_FOUND": "?? ??????? ??????",
    "CONFIRM": "???????????",
    "SIGNUP": "?????",
    "HOME": "?????",
    "QUERY_PARAMETER": "? ???????? HTTP Query Parameter",
    "HTTP_HEADER": "? ???????? HTTP Request Header",
    "API_DOCS": "API Documentation",
    "ERROR": "?? ??????? ????????? ??????. ?????????? ???????.",
    "SUCCESS": "??????? ???????.",
    "LOGIN": "?????",
    "LOGIN_OR_REGISTER": "????? / ??????????????????",
    "LOGOUT": "?????",
    "VERSION": "??????",
    "OF": "of",
    "AGREEMENT": "??????????"
  }
}

config-java.json5

{
  // set language the API Developer Portal is running in
  "language": "ru",
  // if new languages are available add them here (must exist in assets/i18n)
  "supportedLanguages": ["de", "en", "ru"],
  // do not change this
  "theme": "custom",
  // config options for header
  "hero": {
    "title": "HOME.TITLE",
    "subtitle": "HOME.SUBTITLE",
    // enforces a min height visible header image
    "large": false,
  },
  // config options for navigation below header
  "navigation": {
    "showHomeLink": true,
    "links": [],
    "separator": ""
  },
  // config options for footer
  "footer": {
    // additional links to be shown in footer
    "links": [
      {
        // Cyrillic text
        "name": "Кириллический текст",
        "link": "https://www.example.com/",
        "openInNewTab": true
      }
    ],
    // tell the application how the menu separator should look like
    "separator": "•"
  },
  // specify the entrypoint to the API Management Manager: This is MANDATORY for communication with backend
  "endpoint": "${apiman-manager-ui.api.endpoint}",
  // the SSO role that the manager endpoint requires
  "backendRoles": ["view-profile", "devportaluser"],
  // set authentication details when pressing "login" telling where to redirect for SSO login with keycloak
  "auth": {
    "url": "${apiman.auth.public.url}",
    "realm": "${apiman.auth.realm}",
    "clientId": "devportal"
  },
  // set your desired terms and conditions for API subscriptions here. Could be disabled so no such infos will be shown.
  "terms": {
    "enabled": true,
    // both provided links will always be opened in a new browser tab
    "termsLink": "https://www.apache.org/licenses/LICENSE-2.0",
    "privacyLink": "https://www.apache.org/licenses/LICENSE-2.0"
  }
}

That server responds like:

  "footer": {
    // additional links to be shown in footer
    "links": [
      {
        "name": "?????????????? ?????",
        "link": "https://www.example.com",
        "openInNewTab": true
      }
    ],
    // tell the application how the menu separator should look like
    "separator": "?"
  }

Expected behaviour

I expect the Portal to display Cyrillic symbols from i18n files and config-java.json5 configuration.

Actual behaviour

"????????" instead of Cyrillic symbols.

How to Reproduce

This behaviour can be reproduced in compose project. Just mount files to apiman-manager service of docker-compose distro.

volumes:
  - type: bind
    source: "$PWD/data/config-java.json5"
    target: /opt/jboss/wildfly/standalone/configuration/portal/assets/config-java.json5
  - type: bind
    source: "$PWD/data/ru.json"
    target: /opt/jboss/wildfly/standalone/configuration/portal/assets/i18n/ru.json
  - type: bind
    source: "$PWD/data/apiman.properties"
    target: /opt/jboss/wildfly/standalone/configuration/apiman.properties
  - type: bind
    source: "$PWD/data/default-gateway.json"
    target: /opt/jboss/wildfly/standalone/data/bootstrap/default-gateway.json

Relevant log output

No response

Anything else?

No response

@msavy msavy added the Needs Sponsorship Sponsor Apiman's developers to implement this feature label Oct 12, 2023
@msavy
Copy link
Member

msavy commented Oct 12, 2023

Thanks, I don't currently have any paying customers who use Cyrillic, so I'm not sure when I will have the financial resources to invest in working on this.

@volkflo
Copy link
Member

volkflo commented Oct 12, 2023

We use this lib for internationalization, you may have to check if this is supported or not.
https://github.com/ngx-translate/core

@nosbuka
Copy link
Author

nosbuka commented Oct 14, 2023

We use this lib for internationalization, you may have to check if this is supported or not.

https://github.com/ngx-translate/core

Thank you. I started portal on local machine and all the Cyrillic symbols successfully appear. So, the problem is not in translate lib.

Do you have any idea of what happens with encoding when the app works in container?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Sponsorship Sponsor Apiman's developers to implement this feature S: Triage T: Bug
Projects
None yet
Development

No branches or pull requests

3 participants