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

I18n debug #1541

Merged
merged 15 commits into from
Feb 8, 2019
Merged

I18n debug #1541

merged 15 commits into from
Feb 8, 2019

Conversation

chandlerprall
Copy link
Contributor

@chandlerprall chandlerprall commented Feb 6, 2019

Summary

Re-doing PR from #1512 as I managed to merge that (and then revert it) while writing this summary.

Huge thanks to @lizozom for initial setup for this work.

  • changing locale on the docs UI to preview 18n features (only enabled in development)
  • new I18n Tokens page in docs, listing all available tokens, their default values, and locations in code
  • token validation at build time to make sure tokens with the same name have the same default value

toggle for pseudo-translation, showing text that has been localized

Toggle is only present in development environments. It's kinda ugly, could use a design pass.

pseudo-translation selector

new I18n Tokens docs page

tokens page

Checklist

- [ ] This was checked in mobile
- [ ] This was checked in IE11
- [ ] This was checked in dark mode
- [ ] Any props added have proper autodocs

  • Documentation examples were added
  • A changelog entry exists and is marked appropriately
    - [ ] This was checked for breaking changes and labeled appropriately
    - [ ] Jest tests were updated or added to match the most common scenarios
    - [ ] This was checked against keyboard-only and screenreader scenarios
    - [ ] This required updates to Framer X components

@cchaos
Copy link
Contributor

cchaos commented Feb 6, 2019

Hmm, can we put the toggle in a less prominent place in the docs? Maybe it's another option in the dropdown? @snide ?

@snide
Copy link
Contributor

snide commented Feb 6, 2019

Yep. I'll provide a design PR for this tomorrow. Off hand a gear popover that has all these kinds of toggles in one place would be good. I think we can also likely remove the K6 themes (not the dist) from the docs at this point since EUI should essentially be locked for 6.x now.

}

function handleJSXPath(path) {
if (path.node.name.name === 'EuiI18n') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also checked below, for the JSXOpeningElement handler. Is it needed here also?

}

(async () => {
const files = (await asyncGlob(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use glob.sync to simplify things.

const CHARS_FOR_PSEUDO_LOCALIZATION_REGEX = /[a-z]/gi;

/**
* Replaces every latin char by pseudo char and repeats every third char twice.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iä! Iä! Cthulhu fhtagn!

@chandlerprall chandlerprall merged commit e4f7d1d into elastic:master Feb 8, 2019
@chandlerprall chandlerprall deleted the i18n-debug branch February 8, 2019 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants