embedded_localization 1.3.0 → 1.3.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 +4 -4
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/codeql-analysis.yml +72 -0
- data/.github/workflows/ruby.yml +64 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +4 -1
- data/README.md +7 -5
- data/Rakefile +7 -0
- data/embedded_localization.gemspec +2 -1
- data/lib/embedded_localization/version.rb +1 -1
- data/lib/embedded_localization.rb +1 -0
- data/spec/spec_helper.rb +11 -0
- metadata +24 -7
- data/.travis.yml +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 162d9b08b64767f51c21f4b82a05973b3f8b351c783e0d8dc11b9d79e67900fd
|
4
|
+
data.tar.gz: d397c1f3bcdc9968ea13b375c2434c7c9eab5fd298c89ae91f607e050a93a14f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dafa255cbae9e668e862e6cb7dbf684554d205c14b14dd34e13dfd8e5516e556545558cecbd313f1b87957d4ddd81b9c5a8e7ef80bb0f9545ac2c836969f9d6
|
7
|
+
data.tar.gz: 8284a738edaf160761752d7eeaaa6ff73a24cc898b82c46dbca830c6ce39a66f524f7ad1d287cc88d3749ae01869cc61ae091c0e5ca3c022ee6935465369d79f
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
2
|
+
# to commit it to your repository.
|
3
|
+
#
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
5
|
+
# or to provide custom queries or build logic.
|
6
|
+
#
|
7
|
+
# ******** NOTE ********
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
10
|
+
# supported CodeQL languages.
|
11
|
+
#
|
12
|
+
name: "CodeQL"
|
13
|
+
|
14
|
+
on:
|
15
|
+
push:
|
16
|
+
branches: [ "main" ]
|
17
|
+
pull_request:
|
18
|
+
# The branches below must be a subset of the branches above
|
19
|
+
branches: [ "main" ]
|
20
|
+
schedule:
|
21
|
+
- cron: '39 11 * * 2'
|
22
|
+
|
23
|
+
jobs:
|
24
|
+
analyze:
|
25
|
+
name: Analyze
|
26
|
+
runs-on: ubuntu-latest
|
27
|
+
permissions:
|
28
|
+
actions: read
|
29
|
+
contents: read
|
30
|
+
security-events: write
|
31
|
+
|
32
|
+
strategy:
|
33
|
+
fail-fast: false
|
34
|
+
matrix:
|
35
|
+
language: [ 'ruby' ]
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
37
|
+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
38
|
+
|
39
|
+
steps:
|
40
|
+
- name: Checkout repository
|
41
|
+
uses: actions/checkout@v4
|
42
|
+
|
43
|
+
# Initializes the CodeQL tools for scanning.
|
44
|
+
- name: Initialize CodeQL
|
45
|
+
uses: github/codeql-action/init@v3
|
46
|
+
with:
|
47
|
+
languages: ${{ matrix.language }}
|
48
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
49
|
+
# By default, queries listed here will override any specified in a config file.
|
50
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
51
|
+
|
52
|
+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
53
|
+
# queries: security-extended,security-and-quality
|
54
|
+
|
55
|
+
|
56
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
57
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
58
|
+
- name: Autobuild
|
59
|
+
uses: github/codeql-action/autobuild@v3
|
60
|
+
|
61
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
62
|
+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
63
|
+
|
64
|
+
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
65
|
+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
66
|
+
|
67
|
+
# - run: |
|
68
|
+
# echo "Run, Build Application using script"
|
69
|
+
# ./location_of_script_within_repo/buildscript.sh
|
70
|
+
|
71
|
+
- name: Perform CodeQL Analysis
|
72
|
+
uses: github/codeql-action/analyze@v3
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# install dependencies and run tests
|
2
|
+
# https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
3
|
+
|
4
|
+
name: Ruby
|
5
|
+
|
6
|
+
on:
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- main
|
10
|
+
|
11
|
+
pull_request:
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
test_matrix:
|
15
|
+
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
os:
|
20
|
+
- ubuntu
|
21
|
+
- macos
|
22
|
+
ruby:
|
23
|
+
- 2.5
|
24
|
+
- 2.6
|
25
|
+
- 2.7
|
26
|
+
- "3.0"
|
27
|
+
- 3.1
|
28
|
+
- 3.2
|
29
|
+
- 3.3
|
30
|
+
- head
|
31
|
+
- truffleruby
|
32
|
+
- truffleruby-head
|
33
|
+
- mingw
|
34
|
+
- jruby
|
35
|
+
- jruby-head
|
36
|
+
exclude:
|
37
|
+
- { os: ubuntu, ruby: mingw }
|
38
|
+
- { os: macos, ruby: mingw }
|
39
|
+
- { os: windows, ruby: truffleruby }
|
40
|
+
- { os: windows, ruby: truffleruby-head }
|
41
|
+
|
42
|
+
runs-on: ${{ matrix.os }}-latest
|
43
|
+
|
44
|
+
steps:
|
45
|
+
- name: clone ${{ github.repository }}
|
46
|
+
uses: actions/checkout@v4
|
47
|
+
- name: setup Ruby ${{ matrix.ruby }}
|
48
|
+
uses: ruby/setup-ruby@v1
|
49
|
+
with:
|
50
|
+
ruby-version: ${{ matrix.ruby }}
|
51
|
+
bundler-cache: true
|
52
|
+
env:
|
53
|
+
JAVA_OPTS: -Djdk.io.File.enableADS=true
|
54
|
+
- name: Run tests
|
55
|
+
run: bundle exec rake
|
56
|
+
env:
|
57
|
+
JAVA_OPTS: -Djdk.io.File.enableADS=true
|
58
|
+
|
59
|
+
finish:
|
60
|
+
runs-on: ubuntu-latest
|
61
|
+
needs: [ test_matrix ]
|
62
|
+
steps:
|
63
|
+
- name: Wait for status checks
|
64
|
+
run: echo "All Green!"
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# EmbeddedLocalization CHANGE LOG
|
2
2
|
|
3
|
+
## 1.3.1 (2024-11-26)
|
4
|
+
* [Issue 14](https://github.com/tilo/embedded_localization/pull/14) Fix active support proxy object deprecation (thanks to [Romain Morlevat](https://github.com/RomainMorlevat))
|
5
|
+
|
3
6
|
## 1.3.0 (2024-11-13)
|
4
|
-
|
7
|
+
* fixed ([issue 10](https://github.com/tilo/embedded_localization/issues)) to support Rails >= 7.1 (thanks to [Romain Morlevat](https://github.com/RomainMorlevat))
|
5
8
|
|
6
9
|
## 1.2.2 (2022-04-25)
|
7
10
|
* improved docs
|
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# Embedded Localization
|
2
2
|
|
3
|
-
[](https://codecov.io/gh/tilo/embedded_localization)  [View on RubyGems](https://rubygems.org/gems/embedded_localization)
|
4
4
|
|
5
|
-
`embedded_localization`
|
5
|
+
`embedded_localization` allows you to store your translations directly insight each record.
|
6
6
|
|
7
|
-
`embedded_localization` is
|
7
|
+
`embedded_localization` is compatible with Rails 6.x, 7.x, and adds model translations to ActiveRecord, and is compatible with and builds on the [I18n API in Ruby on Rails](http://guides.rubyonrails.org/i18n.html)
|
8
|
+
|
9
|
+
`embedded_localization` is very lightweight, and allows you to transparently store multiple translations of attributes right inside each record — no extra database tables needed to store the localization data! Make sure that your database default encoding is UTF-8 or UFT-16.
|
8
10
|
|
9
11
|
Model translations with `embedded_localization` use default ActiveRecord features and do not limit any ActiveRecord functionality.
|
10
12
|
|
@@ -13,7 +15,7 @@ On top of that, you also get tools for checking into which locales an attribute
|
|
13
15
|
|
14
16
|
## Motivation
|
15
17
|
|
16
|
-
One real-life scenario is that you have a SaaS system which needs custom text for each company, which also needs to be translated in to several languages. Another scenario is that you have dynamic content that needs to be translated.
|
18
|
+
One real-life scenario is that you have a SaaS system which needs custom text for each company, which also needs to be translated in to several languages. Product translations are another use case, as well as movies, books, TV-shows, etc. Another scenario is that you have dynamic content that needs to be translated.
|
17
19
|
|
18
20
|
A recent project needed some localization support for ActiveRecord model data, but I did not want to clutter the schema with one additional table for each translated model, as the globalize gem requires. A second requirement was to allow SQL queries of the fields using the default locale.
|
19
21
|
|
@@ -24,7 +26,7 @@ If your requirements are different, this approach might not work for you. In tha
|
|
24
26
|
|
25
27
|
## Requirements
|
26
28
|
|
27
|
-
* ActiveRecord >= 6
|
29
|
+
* ActiveRecord >= 6 # including 7.x
|
28
30
|
* [I18n](http://guides.rubyonrails.org/i18n.html)
|
29
31
|
|
30
32
|
## Installation
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["tilo.sloboda@gmail.com"]
|
10
10
|
spec.homepage = "https://github.com/tilo/embedded_localization"
|
11
11
|
spec.summary = %q{Rails I18n: library for embedded ActiveRecord model/data translation}
|
12
|
-
spec.description = %q{Rails I18n:
|
12
|
+
spec.description = %q{Rails I18n: a very lightweight tool to allow you to transparently store multiple translations of attributes directly inside each DB record -- no extra database tables needed to store the localization data!}
|
13
13
|
|
14
14
|
# spec.platform = Gem::Platform::RUBY
|
15
15
|
spec.required_ruby_version = ">= 2.5.0"
|
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
spec.licenses = ['MIT']
|
26
26
|
# specify any dependencies here; for example:
|
27
|
+
spec.add_development_dependency "codecov"
|
27
28
|
spec.add_development_dependency "rspec"
|
28
29
|
spec.add_development_dependency "activerecord", ">= 6"
|
29
30
|
spec.add_development_dependency "i18n"
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
require 'active_record'
|
2
2
|
require 'i18n'
|
3
3
|
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start do
|
6
|
+
add_filter '/spec/'
|
7
|
+
add_filter "/pkg/"
|
8
|
+
end
|
9
|
+
|
10
|
+
if ENV['CI'] == 'true' || ENV['CODECOV_TOKEN']
|
11
|
+
require 'codecov'
|
12
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
13
|
+
end
|
14
|
+
|
4
15
|
require 'embedded_localization'
|
5
16
|
|
6
17
|
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embedded_localization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tilo Sloboda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: codecov
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rspec
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,17 +80,20 @@ dependencies:
|
|
66
80
|
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
|
-
description: 'Rails I18n:
|
70
|
-
|
71
|
-
|
83
|
+
description: 'Rails I18n: a very lightweight tool to allow you to transparently store
|
84
|
+
multiple translations of attributes directly inside each DB record -- no extra database
|
85
|
+
tables needed to store the localization data!'
|
72
86
|
email:
|
73
87
|
- tilo.sloboda@gmail.com
|
74
88
|
executables: []
|
75
89
|
extensions: []
|
76
90
|
extra_rdoc_files: []
|
77
91
|
files:
|
92
|
+
- ".github/dependabot.yml"
|
93
|
+
- ".github/workflows/codeql-analysis.yml"
|
94
|
+
- ".github/workflows/ruby.yml"
|
78
95
|
- ".gitignore"
|
79
|
-
- ".
|
96
|
+
- ".rspec"
|
80
97
|
- CHANGELOG.md
|
81
98
|
- Gemfile
|
82
99
|
- README.md
|
@@ -117,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
134
|
- !ruby/object:Gem::Version
|
118
135
|
version: '0'
|
119
136
|
requirements: []
|
120
|
-
rubygems_version: 3.
|
137
|
+
rubygems_version: 3.5.4
|
121
138
|
signing_key:
|
122
139
|
specification_version: 4
|
123
140
|
summary: 'Rails I18n: library for embedded ActiveRecord model/data translation'
|
data/.travis.yml
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
bundler_args: --without development
|
3
|
-
before_install:
|
4
|
-
- gem install bundler
|
5
|
-
- gem update --system
|
6
|
-
|
7
|
-
matrix:
|
8
|
-
include:
|
9
|
-
- rvm: 2.2.10
|
10
|
-
- rvm: 2.3.8
|
11
|
-
- rvm: 2.4.10
|
12
|
-
- rvm: 2.5.8
|
13
|
-
- rvm: 2.6.9
|
14
|
-
- rvm: 2.7.5
|
15
|
-
- rvm: 3.0.3
|
16
|
-
- rvm: 3.1.0
|
17
|
-
- rvm: 3.2.0
|
18
|
-
- rvm: 3.3.0
|
19
|
-
- rvm: jruby-9.2.19.0
|
20
|
-
- rvm: jruby-9.3.3.0
|
21
|
-
- jruby-head
|
22
|
-
- mruby
|
23
|
-
- rubinius
|
24
|
-
- ree
|
25
|
-
|
26
|
-
env:
|
27
|
-
- JRUBY_OPTS="--server -Xcompile.invokedynamic=false -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -J-Xms512m -J-Xmx1024m"
|
28
|
-
- rvm: ruby-head
|
29
|
-
|
30
|
-
branches:
|
31
|
-
only:
|
32
|
-
- master
|