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

[2.x manual backport]Change the locale dynamically by adding &i18n-locale to URL (#7686) #7781

Merged
merged 1 commit into from
Aug 22, 2024

Commits on Aug 21, 2024

  1. [2.x manual backport]Change the locale dynamically by adding &i18n-lo…

    …cale to URL (opensearch-project#7686)
    
    Backport PR:
    opensearch-project#7686
    
    * Change the locale dynamically by adding &i18n-locale to URL
    
    The main issue was the inability to dynamically change the locale in OpenSearch
    Dashboards. Currently we need to update config file and i18nrc.json.
    
    This PR allows  users to switch to a different locale (e.g., from English to Chinese)
    by appending or modifying the 'i18n-locale' parameter in the URL.
    
    * getAndUpdateLocaleInUrl: If a non-default locale is found, this function reconstructs
    the URL with the locale parameter in the correct position.
    * updated the ScopedHistory class, allowing it to detect locale changes and trigger reloads
    as necessary.
    * modify the i18nMixin, which sets up the i18n system during server startup, to register
    all available translation files during server startup, not just the current locale.
    * update the uiRenderMixin to accept requests for any registered locale and dynamically
    load and cache translations for requested locales.
    
    ---------
    
    Signed-off-by: Anan Zhuang <ananzh@amazon.com>
    Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
    ananzh and opensearch-changeset-bot[bot] committed Aug 21, 2024
    Configuration menu
    Copy the full SHA
    67c9d0d View commit details
    Browse the repository at this point in the history