This repository has been archived by the owner on Jan 23, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
During today’s National Day of Civic Hacking in Charlotte, Jim van Fleet (co-captain for Code for Charlotte) showed off the NC Balance project to me and a few other new people. He was asked the question how it works with different languages, and we looked at the code and noticed the somewhat primitive
if
/else
clauses in the message generator. We figured that we could make this better by using the Rubyi18n
package instead.This change does not change the messages in any way other than using
I18n.t to
translate them with. New languages can easily be added by adding a new case statement to the language assignment inMessageGenerator.initialize
as well as a file inconfig/locales
.Added support for internationalization to alleviate if/else bloat.
Loading locales into Sinatra on initialization.
Updated specs to work with
i18n
andsinatra/i18n
.Updated
message_generator.rb
withI18n.t
usage.