multi_formal_i18n_tenancy 0.0.1 → 0.0.2
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.
- data/README.rdoc +11 -13
- data/lib/multi_formal_i18n_tenancy.rb +3 -3
- data/lib/multi_formal_i18n_tenancy/version.rb +1 -1
- metadata +7 -7
data/README.rdoc
CHANGED
@@ -1,26 +1,27 @@
|
|
1
1
|
= MultiFormalI18nTenancy {<img src="https://secure.travis-ci.org/Applicat/multi_formal_i18n_tenancy.png" />}[http://travis-ci.org/Applicat/multi_formal_i18n_tenancy] {<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/Applicat/multi_formal_i18n_tenancy] {<img src="https://gemnasium.com/Applicat/multi_formal_i18n_tenancy.png?travis"/>}[https://gemnasium.com/Applicat/multi_formal_i18n_tenancy]
|
2
2
|
|
3
|
-
This gem extend the standard i18n backend (I18n::Backend::Simple) to introduce {Conventions over configuration}[http://en.wikipedia.org/wiki/Convention_over_configuration] about 2 new types of locale files
|
3
|
+
This gem extend the standard i18n backend (I18n::Backend::Simple) to introduce {Conventions over configuration}[http://en.wikipedia.org/wiki/Convention_over_configuration] about 2 new types of locale files.
|
4
4
|
|
5
|
-
|
5
|
+
== Conventions
|
6
|
+
|
7
|
+
<b>1 ) *_formal.yml</b>
|
6
8
|
|
7
9
|
Given you want to offer your users the option to be addressed formally or informally through a session locale switch:
|
8
10
|
|
9
|
-
I18n.locale = :de # or :de_formal
|
11
|
+
I18n.locale = :de # or :de_formal
|
10
12
|
|
11
13
|
So this is a {DRY}[http://en.wikipedia.org/wiki/Don%27t_repeat_yourself] solution for the workaround about having duplication of de locales in the de_formal namespace even though informal & formal translation are the same.
|
12
14
|
|
13
15
|
This locale file owns all translations from its base *.yml and lets you override them through the same translation keys (except of the deviant locale namespaces de and de_formal at the beginning).
|
14
16
|
|
15
|
-
<b
|
17
|
+
<b>2 ) #{locales_path}/tenants/your_tenant_name/**/your_tenant_name.yml</b>
|
16
18
|
|
17
19
|
Given you want to have tenant specific locales through a session locale switch:
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
('Your Tenant Name'.parameterize.gsub('-', '_') + '_de').to_sym == :your_tenant_name_de
|
21
|
+
# ('Your Tenant Name'.parameterize.gsub('-', '_') + '_de').to_sym == :your_tenant_name_de
|
22
|
+
I18n.locale :your_tenant_name_de # or :your_tenant_name_de_formal
|
22
23
|
|
23
|
-
<
|
24
|
+
<b>Precondition:</b> Assure that you recursively add locale files to i18n's locale path e.g. through your Rails 3 application.rb:
|
24
25
|
|
25
26
|
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
|
26
27
|
|
@@ -38,16 +39,13 @@ OPTIONAL: you have to manually set the i18n backend for your non-rails Ruby appl
|
|
38
39
|
|
39
40
|
I18n.backend = MultiFormalI18nTenancy::Backend.new
|
40
41
|
|
41
|
-
== Wiki Docs
|
42
|
-
|
43
|
-
* {Modules}[https://github.com/Applicat/multi_formal_i18n_tenancy/wiki/modules]
|
44
|
-
|
45
42
|
== Compatibility
|
46
43
|
|
47
44
|
Tested on MacOS with: Rails 3.1 & Ruby 1.9.2, Rails 3.2.6 & Ruby 1.9.3.
|
48
45
|
|
49
|
-
= Future
|
46
|
+
= Future
|
50
47
|
|
48
|
+
* automatically add an before filter to rails controller which includes the tenant scope in the locale
|
51
49
|
* Support of more backends than only standard simple one
|
52
50
|
|
53
51
|
== Contribution
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_formal_i18n_tenancy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-07-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
16
|
-
requirement: &
|
16
|
+
requirement: &70230785180340 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70230785180340
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70230785178460 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 2.11.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70230785178460
|
36
36
|
description: Your formal locales will inherit translations from their base locale
|
37
37
|
and locales stored in an enterprise folder can override base + formal translations
|
38
38
|
email:
|
@@ -69,7 +69,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
69
|
version: '0'
|
70
70
|
segments:
|
71
71
|
- 0
|
72
|
-
hash:
|
72
|
+
hash: 2892429864419253687
|
73
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: '0'
|
79
79
|
segments:
|
80
80
|
- 0
|
81
|
-
hash:
|
81
|
+
hash: 2892429864419253687
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
84
|
rubygems_version: 1.8.17
|