Last active
May 7, 2017 15:55
-
-
Save daniel-rikowski/0dc50fe88b6d6f2309eaf33af16a6d92 to your computer and use it in GitHub Desktop.
Runnable application for https://github.com/svenfuchs/i18n/issues/366
This file contains 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
de: | |
customer: Kunde | |
welcome: Willkommen, %{user} |
This file contains 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
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'i18n', '0.8.1' # Broken | |
# gem 'i18n', '0.8.0' # Works | |
end | |
class Customer | |
def to_s | |
I18n.translate(:customer) | |
end | |
end | |
I18n.available_locales = %w(de de-DE) | |
I18n.locale = 'de-DE' | |
I18n.load_path = [File.join(__dir__, 'de.yml')] | |
I18n::Backend::Simple.include(I18n::Backend::Fallbacks) | |
I18n::Locale::Tag.implementation = I18n::Locale::Tag::Simple | |
puts I18n.translate(:welcome, user: Customer.new) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment