-
Notifications
You must be signed in to change notification settings - Fork 27
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
chore: add localization to UI and components #153
Conversation
Couple of edits:
|
@fmaclen I'm still working on this, I still haven't tried all the possible cases to see is every text is showing correclty. Also, I've just merged However, I'd like to ask you to please review it to see if the current approach is correct or if there's anything that needs to be changed. PS: About the failing test, I don't exactly know why it fails. When I run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if you are still working on this but I left you some note changes.
In my experience with large projects that have a lot of localized strings grouping keys by "section" doesn't work very as the project grows.
Mainly because you end up with generic keys such as name
, save
, delete
, server
, etc that need to be used in other "sections", which if you are not super diligent about keeping things organized you quickly run into duplicates.
I think your grouping is okay for now, but we will probably start moving most of those keys up to the parent en
tree.
Thanks for the feedback! I'll apply the corrections. Also, I was wondering on how to translate this, as it has text interpolated with |
Yeah, these cases are tricky because we would need to interpolate components in the middle of a string. I think the realistic solution to this issue is to re-write the sentences in such a way so the labels in the components can stand alone. For example:
And in this example we can keep the
It sounds a bit more "robotic" but I think it's fine for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Minor change in the
sectionPage
naming convention. - We are missing the localized sentences in the Settings page, I left you some suggestions in this comment.
- We are also missing some dialog confirmations, errors, toast messages
src/lib/i18n.ts
Outdated
session_one: 'Session', | ||
session_other: 'Sessions', | ||
knowledge_one: 'Knowledge', | ||
knowledge_other: 'Knowledge', | ||
settings: 'Settings', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need sessions
and sessionPage
, you can just do:
sessions: {
one: "Session",
other: "Sessions"
}
settings: {
one: "Setting",
}
Err, this doesn't work the way I was hoping it would 😞
Leave the naming convention you have already with the section
and sectionPage
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll likely end up moving most of the keys as direct children of translation: { }
@fmaclen I've translated the remaining texts.
About this quote of this comment, I've tried it in several ways using the escaping options, but I couldn't get to the desired result (image below), so for now I left the unformatted text in the translation. As for the rest of texts with interpolated |
Try the svelte syntax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think everything else looks good, once you fix the escaping issue let's get this one merged 👍
Thank you! It worked!
About the example, I think you can get rid of the 'hack' by using |
🎉 This PR is included in version 0.10.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Closes #150