i18n-sequel_bitemporal 0.10.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +0 -3
- data/{README.textile → README.md} +50 -44
- data/i18n-sequel_bitemporal.gemspec +1 -1
- data/lib/i18n/sequel_bitemporal/version.rb +1 -1
- metadata +5 -14
- data/ci/Gemfile.rails-4.0 +0 -21
- data/ci/Gemfile.rails-4.1 +0 -21
- data/ci/Gemfile.rails-4.2 +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f731e3323b34e7a0253dee70fbd08d2dd8cff9b3589347908663d8905840baff
|
4
|
+
data.tar.gz: d42a2810825195aec26371edd59724e1058b994c8c8215f56cd9b5595272072a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da5c601442f074c486ff12ddae35576a73bdc33ad269b9a1463360d404dbce1d8843215db794e079046b8b85d8571a376c2a57ad25f966b554e9a43853ac783d
|
7
|
+
data.tar.gz: 4467d7ffa4f04ada44ac4df07906ae17c2ae2e49b4fbd6714d4910503a456be800a2f6918b769e75b84511030203ab7e3ef2db508edf5de9c3b9e4c49af0c465
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1
|
1
|
+
2.5.1
|
data/.travis.yml
CHANGED
@@ -1,36 +1,41 @@
|
|
1
|
-
!https://travis-ci.org/TalentBox/i18n-sequel_bitemporal.svg?branch=master
|
1
|
+
[![Build Status](https://travis-ci.org/TalentBox/i18n-sequel_bitemporal.svg?branch=master)](https://travis-ci.org/TalentBox/i18n-sequel_bitemporal)
|
2
2
|
|
3
|
-
|
3
|
+
# I18n::Backend::SequelBitemporal
|
4
4
|
|
5
|
-
This repository contains an
|
6
|
-
|
7
|
-
|
5
|
+
This repository contains an [I18n](http://github.com/svenfuchs/i18n)
|
6
|
+
Sequel
|
7
|
+
backend storing translations using a bitemporal approach. This allows
|
8
|
+
you go back in time
|
9
|
+
in your translations and schedule new translations to appears in the
|
10
|
+
future without
|
8
11
|
needing any cron task to run.
|
9
12
|
|
10
|
-
Most of the code is a port of the
|
13
|
+
Most of the code is a port of the [ActiveRecord
|
14
|
+
backend](http://github.com/svenfuchs/i18n-activerecord) from SvenFuchs.
|
11
15
|
|
12
|
-
It
|
16
|
+
It’s compatible with I18n \>= 1.0.0 (Rails 5.x)
|
13
17
|
|
14
|
-
|
18
|
+
## Installation
|
15
19
|
|
16
20
|
For Bundler put the following in your Gemfile:
|
17
21
|
|
18
|
-
|
22
|
+
```
|
19
23
|
gem 'i18n-sequel_bitemporal', :require => 'i18n/sequel_bitemporal'
|
20
|
-
|
24
|
+
```
|
21
25
|
|
22
|
-
or to track master
|
26
|
+
or to track master’s HEAD:
|
23
27
|
|
24
|
-
|
28
|
+
```
|
25
29
|
gem 'i18n-sequel_bitemporal',
|
26
30
|
:github => 'TalentBox/i18n-sequel_bitemporal',
|
27
31
|
:require => 'i18n/sequel_bitemporal'
|
28
|
-
|
32
|
+
```
|
29
33
|
|
30
|
-
Next create a sequel migration with the Rails Generator (if you
|
34
|
+
Next create a sequel migration with the Rails Generator (if you’re using
|
35
|
+
rails-sequel).
|
31
36
|
Your migration should look like this:
|
32
37
|
|
33
|
-
|
38
|
+
```
|
34
39
|
class CreateI18nTranslationsMigration < Sequel::Migration
|
35
40
|
|
36
41
|
def up
|
@@ -60,24 +65,27 @@ Your migration should look like this:
|
|
60
65
|
end
|
61
66
|
|
62
67
|
end
|
63
|
-
|
68
|
+
```
|
64
69
|
|
65
|
-
With these translation tables you will be able to manage your
|
70
|
+
With these translation tables you will be able to manage your
|
71
|
+
translation, and add new translations or languages.
|
66
72
|
|
67
|
-
To load
|
73
|
+
To load `I18n::Backend::SequelBitemporal` into your Rails application,
|
74
|
+
create a new file in **config/initializers** named **locale.rb**.
|
68
75
|
|
69
76
|
A simple configuration for your locale.rb could look like this:
|
70
77
|
|
71
|
-
|
78
|
+
```
|
72
79
|
require 'i18n/backend/sequel_bitemporal'
|
73
80
|
I18n.backend = I18n::Backend::SequelBitemporal.new
|
74
|
-
|
81
|
+
```
|
75
82
|
|
76
|
-
A more advanced example (Thanks Moritz), which uses YAML files and
|
83
|
+
A more advanced example (Thanks Moritz), which uses YAML files and
|
84
|
+
ActiveRecord for lookups:
|
77
85
|
|
78
86
|
Memoization is highly recommended if you use a DB as your backend.
|
79
87
|
|
80
|
-
|
88
|
+
```
|
81
89
|
require 'i18n/backend/sequel_bitemporal'
|
82
90
|
I18n.backend = I18n::Backend::SequelBitemporal.new
|
83
91
|
|
@@ -87,46 +95,44 @@ Memoization is highly recommended if you use a DB as your backend.
|
|
87
95
|
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
|
88
96
|
|
89
97
|
I18n.backend = I18n::Backend::Chain.new(I18n::Backend::Simple.new, I18n.backend)
|
90
|
-
|
98
|
+
```
|
91
99
|
|
92
100
|
You can also customize table names for the backing models:
|
93
101
|
|
94
|
-
|
102
|
+
```
|
95
103
|
require 'i18n/backend/sequel_bitemporal'
|
96
104
|
I18n::Backend::SequelBitemporal.master_table_name = :my_translations
|
97
105
|
I18n::Backend::SequelBitemporal.version_table_name = :my_translation_versions
|
98
|
-
|
106
|
+
```
|
99
107
|
|
100
|
-
Please note names can be anything you can use in
|
108
|
+
Please note names can be anything you can use in
|
109
|
+
\`Sequel::Model\#set\_dataset\`.
|
101
110
|
For example you want your translations table to be in a specific schema:
|
102
111
|
|
103
|
-
|
112
|
+
```
|
104
113
|
require 'i18n/backend/sequel_bitemporal'
|
105
114
|
I18n::Backend::SequelBitemporal.master_table_name = Sequel.qualify(:translations, :i18n_translations)
|
106
115
|
I18n::Backend::SequelBitemporal.version_table_name = Sequel.qualify(:translations, :i18n_translation_versions)
|
107
|
-
|
116
|
+
```
|
108
117
|
|
109
|
-
|
118
|
+
## Usage
|
110
119
|
|
111
|
-
You can now use
|
120
|
+
You can now use `I18n.t('Your String')` to lookup translations in the
|
121
|
+
database.
|
112
122
|
|
113
|
-
|
123
|
+
## Runnning tests
|
114
124
|
|
115
|
-
|
116
|
-
|
117
|
-
BUNDLE_GEMFILE=ci/Gemfile.rails-
|
118
|
-
BUNDLE_GEMFILE=ci/Gemfile.rails-
|
119
|
-
BUNDLE_GEMFILE=ci/Gemfile.rails-
|
120
|
-
BUNDLE_GEMFILE=ci/Gemfile.rails-3.x-i18n-0.6 rake
|
121
|
-
</pre>
|
125
|
+
gem install bundler
|
126
|
+
BUNDLE_GEMFILE=ci/Gemfile.rails-5.x bundle
|
127
|
+
BUNDLE_GEMFILE=ci/Gemfile.rails-5.x-i18n-0.6 bundle
|
128
|
+
BUNDLE_GEMFILE=ci/Gemfile.rails-5.x rake
|
129
|
+
BUNDLE_GEMFILE=ci/Gemfile.rails-5.x-i18n-0.6 rake
|
122
130
|
|
123
131
|
If you want to see what queries are executed:
|
124
132
|
|
125
|
-
|
126
|
-
DEBUG=true BUNDLE_GEMFILE=ci/Gemfile.rails-
|
127
|
-
DEBUG=true BUNDLE_GEMFILE=ci/Gemfile.rails-3.x-i18n-0.6 rake
|
128
|
-
</pre>
|
133
|
+
DEBUG=true BUNDLE_GEMFILE=ci/Gemfile.rails-5.x rake
|
134
|
+
DEBUG=true BUNDLE_GEMFILE=ci/Gemfile.rails-5.x-i18n-0.6 rake
|
129
135
|
|
130
|
-
|
136
|
+
## Maintainers
|
131
137
|
|
132
|
-
|
138
|
+
- Jonathan Tron
|
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
s.add_dependency "i18n", ">=
|
22
|
+
s.add_dependency "i18n", ">= 1.0.0"
|
23
23
|
s.add_dependency "sequel_bitemporal", ">= 0.8.0"
|
24
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-sequel_bitemporal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Tron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -16,20 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.9.0
|
19
|
+
version: 1.0.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 0.9.0
|
26
|
+
version: 1.0.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: sequel_bitemporal
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,11 +52,8 @@ files:
|
|
58
52
|
- ".travis.yml"
|
59
53
|
- Gemfile
|
60
54
|
- MIT-LICENSE
|
61
|
-
- README.
|
55
|
+
- README.md
|
62
56
|
- Rakefile
|
63
|
-
- ci/Gemfile.rails-4.0
|
64
|
-
- ci/Gemfile.rails-4.1
|
65
|
-
- ci/Gemfile.rails-4.2
|
66
57
|
- ci/Gemfile.rails-5.0
|
67
58
|
- ci/Gemfile.rails-5.1
|
68
59
|
- ci/Gemfile.rails-5.2
|
data/ci/Gemfile.rails-4.0
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gemspec :path => "../"
|
4
|
-
|
5
|
-
gem 'railties', '~> 4.0.0'
|
6
|
-
|
7
|
-
gem "test-unit"
|
8
|
-
gem "test_declarative"
|
9
|
-
gem "mocha"
|
10
|
-
gem "rake"
|
11
|
-
gem "timecop"
|
12
|
-
|
13
|
-
platforms :ruby do
|
14
|
-
gem "pg"
|
15
|
-
gem "sqlite3"
|
16
|
-
end
|
17
|
-
|
18
|
-
platforms :jruby do
|
19
|
-
gem "jdbc-postgres"
|
20
|
-
gem "jdbc-sqlite3"
|
21
|
-
end
|
data/ci/Gemfile.rails-4.1
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gemspec :path => "../"
|
4
|
-
|
5
|
-
gem 'railties', '~> 4.1.0'
|
6
|
-
|
7
|
-
gem "test-unit"
|
8
|
-
gem "test_declarative"
|
9
|
-
gem "mocha"
|
10
|
-
gem "rake"
|
11
|
-
gem "timecop"
|
12
|
-
|
13
|
-
platforms :ruby do
|
14
|
-
gem "pg"
|
15
|
-
gem "sqlite3"
|
16
|
-
end
|
17
|
-
|
18
|
-
platforms :jruby do
|
19
|
-
gem "jdbc-postgres"
|
20
|
-
gem "jdbc-sqlite3"
|
21
|
-
end
|
data/ci/Gemfile.rails-4.2
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gemspec :path => "../"
|
4
|
-
|
5
|
-
gem 'railties', '~> 4.2.0'
|
6
|
-
|
7
|
-
gem "test-unit"
|
8
|
-
gem "test_declarative"
|
9
|
-
gem "mocha"
|
10
|
-
gem "rake"
|
11
|
-
gem "timecop"
|
12
|
-
|
13
|
-
platforms :ruby do
|
14
|
-
gem "pg"
|
15
|
-
gem "sqlite3"
|
16
|
-
end
|
17
|
-
|
18
|
-
platforms :jruby do
|
19
|
-
gem "jdbc-postgres"
|
20
|
-
gem "jdbc-sqlite3"
|
21
|
-
end
|