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 #77

Merged
merged 24 commits into from
Jun 12, 2021
Merged

i18n #77

merged 24 commits into from
Jun 12, 2021

Conversation

eibex
Copy link
Owner

@eibex eibex commented Jun 8, 2021

Implement i18n module for easy l10n with json files.

Closes #74

Copy link
Contributor

@Edwinexd Edwinexd left a comment

Choose a reason for hiding this comment

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

Looks good so far, dropped a few suggestions/opinions here and there 👍

core/i18n.py Outdated Show resolved Hide resolved
except KeyError:
response = self.responses["en"][item]
print(f"Could not find a translation ({self.language}) for the requested i18n item: {item}. Please file an issue on GitHub.")
response = response.replace("{prefix}", self.prefix)
Copy link
Contributor

Choose a reason for hiding this comment

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

Feels like this should be handled in the .format elsewhere, seems odd to only handle this replacement here.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I did it like this because it's the only var that is fixed and present across several strings.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Wouldn't it feel redundant to .format(prefix) everywhere?

Copy link
Contributor

Choose a reason for hiding this comment

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

True, although I don't like the concept of one variable being handled differently from the others, might get confusing down the line

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yeah, I can see your point too.
I will leave this unresolved for now while I think about it.

bot.py Outdated Show resolved Hide resolved
eibex and others added 2 commits June 9, 2021 21:15
Co-authored-by: Martin Stone <1611702+d7415@users.noreply.github.com>
@eibex eibex marked this pull request as ready for review June 9, 2021 21:09
@eibex
Copy link
Owner Author

eibex commented Jun 9, 2021

Ready for review, working on a translation and the fairly simple rl!language command.

@eibex eibex merged commit cc7836e into master Jun 12, 2021
@eibex eibex deleted the i18n branch June 12, 2021 14:02
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.

localization
3 participants