This repository was archived by the owner on Jan 23, 2024. It is now read-only.
Using standard Ruby i18n library#355
Open
tbjers wants to merge 1 commit intocodeforamerica:masterfrom
tbjers:master
Open
Using standard Ruby i18n library#355tbjers wants to merge 1 commit intocodeforamerica:masterfrom tbjers:master
i18n library#355tbjers wants to merge 1 commit intocodeforamerica:masterfrom
tbjers:master
Conversation
Added support for internationalization to alleviate if/else bloat. Loading locales into Sinatra on initialization. Updated specs to work with `i18n` and `sinatra/i18n`. Updated `message_generator.rb` with `I18n.t` usage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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/elseclauses in the message generator. We figured that we could make this better by using the Rubyi18npackage instead.This change does not change the messages in any way other than using
I18n.t totranslate them with. New languages can easily be added by adding a new case statement to the language assignment inMessageGenerator.initializeas 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
i18nandsinatra/i18n.Updated
message_generator.rbwithI18n.tusage.