i18n 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00ca216533d9fa4b869395ffc218a4c048b5d86c3db3b93d6cae489e7578a7a9
4
- data.tar.gz: 805b70e0c7cc30d1c11c60ccb52d8e9e1c5693a86e57690959c182dc40005af3
3
+ metadata.gz: e56b50c83ab6291a1321b462814b80ad73d74d01cb77c25ab6a1d948c8737afc
4
+ data.tar.gz: 23d1ac1b19a36a2543e063f612170f45be6d404d2ff258c611c75be159dde98c
5
5
  SHA512:
6
- metadata.gz: fbe0187478522d98f7fe3ff79c71b1ebc0b34e6f3dc9bdd44803fbe7cdab192458dda74a501dc03ad9a55b6433298c53f3ebadc4132da2b00790e239ae88ebe8
7
- data.tar.gz: b6cfa2da751b722fc379263f6dadf82b383fc8cfdddf5e7ac2722992e577361c3ee8dbe0df97b15f781ddbb971eb8f27dda034b732a1cb5d1e9a6ec31e9bd415
6
+ metadata.gz: b555490dcb1c101f72f04f6ce9f257070da32021906355f7ccf96ee8ef62d33fda682e75bfb634d91c13afc72fa2d6f74135721a0df40c473edb083cf0a04360
7
+ data.tar.gz: 810d9280d42cf03d60d4251371bad79f602799b786660413e00b8f4d351a81c70b0ad7f4223ac276d0600721139e367b2b39a656f6d60335993bcc46d30abafb
data/README.md CHANGED
@@ -4,9 +4,52 @@
4
4
 
5
5
  Ruby Internationalization and localization solution.
6
6
 
7
- [See the Rails Guide](http://guides.rubyonrails.org/i18n.html) for an example of its usage. (Note: This library can be used independently from Rails.)
7
+ Currently maintained by @radar.
8
8
 
9
- Features:
9
+ ## Usage
10
+
11
+ ### Rails
12
+
13
+ You will most commonly use this library within a Rails app.
14
+
15
+ [See the Rails Guide](http://guides.rubyonrails.org/i18n.html) for an example of its usage.
16
+
17
+ ### Ruby (without Rails)
18
+
19
+ If you want to use this library without Rails, you can simply add `i18n` to your `Gemfile`:
20
+
21
+ ```ruby
22
+ gem 'i18n'
23
+ ```
24
+
25
+ Then configure I18n with some translations, and a default locale:
26
+
27
+ ```ruby
28
+ I18n.load_path << Dir[File.expand_path("config/locales") + "/*.yml"]
29
+ I18n.default_locale = :en # (note that `en` is already the default!)
30
+ ```
31
+
32
+ A simple translation file in your project might live at `config/locales/en.yml` and look like:
33
+
34
+ ```yml
35
+ en:
36
+ test: "This is a test"
37
+ ```
38
+
39
+ You can then access this translation by doing:
40
+
41
+ ```ruby
42
+ I18n.t(:test)
43
+ ```
44
+
45
+ You can switch locales in your project by setting `I18n.locale` to a different value:
46
+
47
+ ```ruby
48
+ I18n.locale = :de
49
+ I18n.t(:test) # => "Dies ist ein Test"
50
+ ```
51
+
52
+ ## Features
10
53
 
11
54
  * translation and localization
12
55
  * interpolation of values to translations (Ruby 1.9 compatible syntax)
@@ -19,7 +62,7 @@ Features:
19
62
  * custom exception handlers
20
63
  * extensible architecture with a swappable backend
21
64
 
22
- Pluggable features:
65
+ ## Pluggable Features
23
66
 
24
67
  * Cache
25
68
  * Pluralization: lambda pluralizers stored as translation data
@@ -27,7 +70,7 @@ Pluggable features:
27
70
  * [Gettext support](https://github.com/svenfuchs/i18n/wiki/Gettext)
28
71
  * Translation metadata
29
72
 
30
- Alternative backends:
73
+ ## Alternative Backend
31
74
 
32
75
  * Chain
33
76
  * ActiveRecord (optionally: ActiveRecord::Missing and ActiveRecord::StoreProcs)
@@ -35,12 +78,6 @@ Alternative backends:
35
78
 
36
79
  For more information and lots of resources see [the 'Resources' page on the wiki](https://github.com/svenfuchs/i18n/wiki/Resources).
37
80
 
38
- ## Installation
39
-
40
- ```
41
- gem install i18n
42
- ```
43
-
44
81
  ## Tests
45
82
 
46
83
  You can run tests both with
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'yaml'
4
4
  require 'i18n/core_ext/hash'
5
- require 'i18n/core_ext/kernel/suppress_warnings'
6
5
 
7
6
  module I18n
8
7
  module Backend
@@ -59,6 +59,14 @@ module I18n
59
59
  super
60
60
  end
61
61
 
62
+ def translations(do_init: false)
63
+ # To avoid returning empty translations,
64
+ # call `init_translations`
65
+ init_translations if do_init && !initialized?
66
+
67
+ @translations ||= {}
68
+ end
69
+
62
70
  protected
63
71
 
64
72
  def init_translations
@@ -66,10 +74,6 @@ module I18n
66
74
  @initialized = true
67
75
  end
68
76
 
69
- def translations
70
- @translations ||= {}
71
- end
72
-
73
77
  # Looks up a translation from the translations hash. Returns nil if
74
78
  # either key is nil, or locale, scope or key do not exist as a key in the
75
79
  # nested translations hash. Splits keys or scopes containing dots
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module I18n
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2018-08-07 00:00:00.000000000 Z
16
+ date: 2018-10-14 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: concurrent-ruby
@@ -62,7 +62,6 @@ files:
62
62
  - lib/i18n/backend/transliterator.rb
63
63
  - lib/i18n/config.rb
64
64
  - lib/i18n/core_ext/hash.rb
65
- - lib/i18n/core_ext/kernel/suppress_warnings.rb
66
65
  - lib/i18n/core_ext/string/interpolate.rb
67
66
  - lib/i18n/exceptions.rb
68
67
  - lib/i18n/gettext.rb
@@ -135,7 +134,11 @@ files:
135
134
  homepage: http://github.com/svenfuchs/i18n
136
135
  licenses:
137
136
  - MIT
138
- metadata: {}
137
+ metadata:
138
+ bug_tracker_uri: https://github.com/svenfuchs/i18n/issues
139
+ changelog_uri: https://github.com/svenfuchs/i18n/releases
140
+ documentation_uri: https://guides.rubyonrails.org/i18n.html
141
+ source_code_uri: https://github.com/svenfuchs/i18n
139
142
  post_install_message:
140
143
  rdoc_options: []
141
144
  require_paths:
@@ -152,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
155
  version: 1.3.5
153
156
  requirements: []
154
157
  rubyforge_project: "[none]"
155
- rubygems_version: 2.7.3
158
+ rubygems_version: 2.7.6
156
159
  signing_key:
157
160
  specification_version: 4
158
161
  summary: New wave Internationalization support for Ruby
@@ -1,8 +0,0 @@
1
- module Kernel
2
- def suppress_warnings
3
- original_verbosity, $VERBOSE = $VERBOSE, nil
4
- yield
5
- ensure
6
- $VERBOSE = original_verbosity
7
- end
8
- end