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 support #42

Closed
wants to merge 1 commit into from
Closed

I18n support #42

wants to merge 1 commit into from

Conversation

tstrachota
Copy link
Contributor

  • UsageError split into more specific exceptions with parameters. It will enable projects using Clamp to catch such exceptions and print their own translated strings.
  • Heading in HelpBuilder extracted to a function to make overriding easier.

- UsageError split into more specific exceptions with parameters. It will enable projects using Clamp to catch such exceptions and print their own translated strings.
- Heading in HelpBuilder extracted to a function to make overriding easier.
@mdub
Copy link
Owner

mdub commented Apr 6, 2014

Thanks Tomas.

I'm just wondering: is there good reason to introduce the finer-grained exceptions for reasons other than i18n? If not, perhaps it would be simpler if Clamp supported a translation-table for exception messages. You could then localise by overriding them:

Clamp.messages[:too_many_arguments] = "of margir rök"

Would that be easier than having a wrapper that caught exceptions to generate localised messages?

@tstrachota
Copy link
Contributor Author

My primary motivation was translations. I guess a table/Hash would work as well. I can re-write the patch if you prefer the table style.

@mdub
Copy link
Owner

mdub commented Apr 13, 2014

Yes, let's try the translation table approach, and see how it looks. If you're happy to code it up, that would be great.

@tstrachota
Copy link
Contributor Author

Ok. I'm closing this one and opening #43

@tstrachota tstrachota closed this Apr 17, 2014
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