Skip to content

fix i18n and some tweaks#966

Merged
pngwn merged 5 commits into
blocks-devfrom
933-i18n-fix
Apr 8, 2022
Merged

fix i18n and some tweaks#966
pngwn merged 5 commits into
blocks-devfrom
933-i18n-fix

Conversation

@pngwn
Copy link
Copy Markdown
Member

@pngwn pngwn commented Apr 8, 2022

Fix i18n and a few tweaks/ cleans ups to props

Closes #933.

@pngwn
Copy link
Copy Markdown
Member Author

pngwn commented Apr 8, 2022

I don't actually know how to test i18n properly.

@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Apr 8, 2022

For testing, you can change your browser language: https://support.google.com/chrome/answer/173424?hl=en&co=GENIE.Platform%3DDesktop ("Change the language of your Chrome browser" section)

I'll also test it out now

@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Apr 8, 2022

The components look good:

image

However, the buttons are not being translated. This is probably because we hardcode the value of the buttons in the backend when we create them.

@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Apr 8, 2022

So as a solution to this, we could check if a button's value is the i18n dictionary, and if it is, we render the translated version instead

@pngwn
Copy link
Copy Markdown
Member Author

pngwn commented Apr 8, 2022

@abidlabs could we change what we are hardcoding in the backend to be the language item key rather than the english string, basically just the lowercase english string?

Here is the list:

"submit": "Submit",
"clear": "Clear",
"interpret": "Interpret",
"flag": "Flag",
"examples": "Examples"

@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Apr 8, 2022

Yup definitely, let me push that now

@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Apr 8, 2022

Actually thinking about it again, it makes more sense to update the keys in the internationalization files to be the cased versions, right? Because it doesn't make sense to "translate" from lower case to upper case (if their locale is English)

In other words, what I'm saying is that if a user creates a button like Button("submit"), it should not get changed to say "Submit" instead of "submit"

@pngwn
Copy link
Copy Markdown
Member Author

pngwn commented Apr 8, 2022

Actually if you could do interface.[word] that would be ideal because if a match isn't found in the i18n lib it just passes through the provided string. Otherwise I"ll need to jump through some hoops to make this work.

$_("interface.submit") -> `Submit`
$_("Some String") -> "Some String"

We can swap to Cased words in the i18n files.

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.

2 participants