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

Superset seems to be ignoring few frontend translations #7792

Closed
NickStarlight opened this issue Jun 28, 2019 · 5 comments
Closed

Superset seems to be ignoring few frontend translations #7792

NickStarlight opened this issue Jun 28, 2019 · 5 comments
Labels
!deprecated-label:bug Deprecated label - Use #bug instead inactive Inactive for >= 30 days

Comments

@NickStarlight
Copy link

Superset internationalization does not seem to be working on few components at the frontend.
The 'Add new slice' menu @ superset/assets/src/addSlice/AddSliceContainer.jsx is one example, even if the @superset-ui module has been called.

import { t } from '@superset-ui/translation';
t('Choose a datasource')

Expected results

All UI elements should be translated.

Actual results

Few frontend elements seem to ignore the translation, i couldn't reproduce the issue on backend rendered components like tables.

How to reproduce the bug

Download the current main branch, or 0.32.0rc2, haven't tested on other releases.

Environment

(please complete the following information):

  • superset version: 0.32.0rc2
  • python version: 3.6
  • node.js version: 12.0

Checklist

  • [*] I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • [*] I have reproduced the issue with at least the latest released version of superset.
  • [*] I have checked the issue tracker for the same issue and I haven't found one similar.
@issue-label-bot issue-label-bot bot added the !deprecated-label:bug Deprecated label - Use #bug instead label Jun 28, 2019
@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.94. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@NickStarlight
Copy link
Author

NickStarlight commented Jun 28, 2019

Replicating the exact same code as described here, fixes the issue partially.

@mistercrunch
Copy link
Member

Could it be that some of the translations have not been "compiled"?
https://github.com/apache/incubator-superset/blob/master/CONTRIBUTING.md#creating-a-new-language-dictionary

@NickStarlight
Copy link
Author

@mistercrunch No, they are just absent, even for existing languages, the add-slice-container itself has no translations being piped to the view, so it's an easy task(As described above), however, most parts of the code do not have translations mechanisms whatsoever.

  1. Tables are using the humanize Python lib for human readable time frames(x days ago, x hours ago), i've managed to fix this by globally setting the language for humanize:

humanize.i18n.activate('code', path='path/to/my/translation/')

We do need to 'compile' new translations for all currently supported languages, since humanize is an abandonware.

  1. Datetime on Python does not seem to print the localized dates, setting the locale globally with locale.setlocale(locale.LC_ALL, 'i18n_code') can lead to troubles, so more investigations on how properly do it on Superset is required.

  2. Moment.js also is absent of any internationalization, importing the locale in preamble.js does fix that.
    import locale from 'moment/locale/i18n_code';

My use case is very specific(One single language support) so all measures above work, but unfortunatelly i can't open a PR with those changes since they do not match the code quality required on Superset and can lead to trouble in the future.

@stale
Copy link

stale bot commented Aug 31, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Aug 31, 2019
@stale stale bot closed this as completed Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
!deprecated-label:bug Deprecated label - Use #bug instead inactive Inactive for >= 30 days
Projects
None yet
Development

No branches or pull requests

2 participants