cmdx-i18n 0.1.1 → 0.3.0
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/.cursor/rules/cursor-instructions.mdc +4 -2
- data/CHANGELOG.md +13 -0
- data/README.md +15 -4
- data/lib/cmdx/i18n/version.rb +1 -1
- data/lib/cmdx/i18n.rb +5 -7
- data/lib/generators/cmdx/i18n/locale_generator.rb +41 -0
- metadata +4 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f4734775d41a6dd96b82b98b99b28f7d577bdae78a9ced6b4fa43da4d731c61
|
4
|
+
data.tar.gz: 20c4295ef038cd0552e88b1676207756c2dd24aa37e4e6981b7e2728534f2886
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0b944ea2ff2d7b5416871df5175991efa6542854b3061d93d43b9a25d3ffbdfc1f110f1758c763564ba3198a02a30e51b1dd5c925f7734de17d7777eb4e3bfb
|
7
|
+
data.tar.gz: bbb8a50ad9361e141bf8f6e0a9a49b5d483f8d59e162a992301765b29e405e683f422d1f9891e818826462da576119013f8f9281a31003dbc12be2177494d958
|
@@ -10,12 +10,14 @@ Follow the official Ruby gem guides for best practices.
|
|
10
10
|
Reference the guides outlined in https://guides.rubygems.org
|
11
11
|
|
12
12
|
## Project Context
|
13
|
-
CMDx
|
14
|
-
|
13
|
+
CMDx::I18n is a collection of localized translations for the CMDx framework.
|
14
|
+
Reference the CMDx documentation in https://github.com/drexed/cmdx/blob/main/LLM.md
|
15
|
+
Reference the CMDx::I18n documentation in https://github.com/drexed/cmdx-i18n/blob/main/README.md
|
15
16
|
|
16
17
|
## Technology Stack
|
17
18
|
- Ruby 3.4+
|
18
19
|
- RSpec 3.1+
|
20
|
+
- CMDx 1.5+
|
19
21
|
|
20
22
|
## Code Style and Structure
|
21
23
|
- Write concise, idiomatic Ruby code with accurate examples
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
|
7
7
|
## [TODO]
|
8
8
|
|
9
|
+
## [0.3.0] - 2025-08-25
|
10
|
+
|
11
|
+
### Changes
|
12
|
+
- Removed zeitwerk gem dependency
|
13
|
+
|
14
|
+
## [0.2.0] - 2025-08-24
|
15
|
+
|
16
|
+
### Added
|
17
|
+
- Generator to copy locales to `config/locales` in a Rails app
|
18
|
+
|
19
|
+
### Changes
|
20
|
+
- Fix railtie requirement issue
|
21
|
+
|
9
22
|
## [0.1.1] - 2025-08-23
|
10
23
|
|
11
24
|
### Changes
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
# CMDx::I18n
|
12
12
|
|
13
|
-
Centralization of
|
13
|
+
Centralization of locales for [CMDx](https://github.com/drexed/cmdx).
|
14
14
|
|
15
15
|
## Installation
|
16
16
|
|
@@ -30,7 +30,18 @@ Or install it yourself as:
|
|
30
30
|
|
31
31
|
## Configuration
|
32
32
|
|
33
|
-
|
33
|
+
If the `I18n` gem is installed in a Rails app, `cmdx-i18n` locales are automatically loaded and are managed through the `I18n.available_locales` option.
|
34
|
+
|
35
|
+
## Local Version
|
36
|
+
|
37
|
+
Execute the following command to copy any locale to the Rails applications `config/locales` directory:
|
38
|
+
|
39
|
+
```bash
|
40
|
+
rails generate cmdx:i18n:locale [LOCALE]
|
41
|
+
|
42
|
+
# Eg: generate french locale
|
43
|
+
rails generate cmdx:i18n:locale fr
|
44
|
+
```
|
34
45
|
|
35
46
|
## Locales
|
36
47
|
|
@@ -129,7 +140,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
129
140
|
|
130
141
|
## Contributing
|
131
142
|
|
132
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
143
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/drexed/cmdx-i18n. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/drexed/cmdx-i18n/blob/master/CODE_OF_CONDUCT.md).
|
133
144
|
|
134
145
|
## License
|
135
146
|
|
@@ -137,4 +148,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
137
148
|
|
138
149
|
## Code of Conduct
|
139
150
|
|
140
|
-
Everyone interacting in the Cmdx::I18n project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
151
|
+
Everyone interacting in the Cmdx::I18n project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/drexed/cmdx-i18n/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/cmdx/i18n/version.rb
CHANGED
data/lib/cmdx/i18n.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "cmdx"
|
4
|
-
|
4
|
+
|
5
|
+
require_relative "i18n/version"
|
5
6
|
|
6
7
|
module CMDx
|
7
8
|
module I18n
|
@@ -15,12 +16,9 @@ module CMDx
|
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
18
|
-
#
|
19
|
-
|
20
|
-
loader.inflector.inflect("cmdx" => "CMDx")
|
21
|
-
loader.ignore("#{__dir__}/locales")
|
22
|
-
loader.setup
|
19
|
+
# Conditionally load Rails components if Rails is available
|
20
|
+
require_relative "generators/cmdx/i18n/copy_generator" if defined?(Rails::Generators)
|
23
21
|
|
24
22
|
# Load the Railtie last after everything else is required so we don't
|
25
23
|
# need to load any CMDx::I18n components when we use this Railtie.
|
26
|
-
require_relative "
|
24
|
+
require_relative "i18n/railtie" if defined?(Rails::Railtie)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdx
|
4
|
+
module I18n
|
5
|
+
# Generates CMDx locale files for Rails applications
|
6
|
+
#
|
7
|
+
# Rails generator that copies CMDx::I18n locale files into the application's
|
8
|
+
# config/locales directory. This allows applications to customize and extend
|
9
|
+
# the default CMDx::I18n locale files.
|
10
|
+
class LocaleGenerator < Rails::Generators::Base
|
11
|
+
|
12
|
+
source_root File.expand_path("../../../locales", __dir__)
|
13
|
+
|
14
|
+
desc "Copies CMDx::I18n locale files into app"
|
15
|
+
|
16
|
+
argument :locale, type: :string, default: "en", banner: "Locale to copy"
|
17
|
+
|
18
|
+
# Copies the locale template to the Rails application
|
19
|
+
#
|
20
|
+
# Copies the specified locale file from the gem's locales directory to the
|
21
|
+
# application's config/locales directory. If the locale file doesn't exist
|
22
|
+
# in the gem, the generator will fail gracefully.
|
23
|
+
#
|
24
|
+
# @return [void]
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# # Copy default (English) locale file
|
28
|
+
# rails generate cmdx:i18n:locale
|
29
|
+
# # => Creates config/locales/en.yml
|
30
|
+
#
|
31
|
+
# # Copy Spanish locale file
|
32
|
+
# rails generate cmdx:i18n:locale es
|
33
|
+
# # => Creates config/locales/es.yml
|
34
|
+
#
|
35
|
+
def copy_locale_files
|
36
|
+
copy_file("#{locale}.yml", "config/locales/#{locale}.yml")
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmdx-i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
@@ -15,28 +15,14 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 1.5.
|
18
|
+
version: 1.5.0
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - ">="
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: 1.5.
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: zeitwerk
|
28
|
-
requirement: !ruby/object:Gem::Requirement
|
29
|
-
requirements:
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '0'
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '0'
|
25
|
+
version: 1.5.0
|
40
26
|
- !ruby/object:Gem::Dependency
|
41
27
|
name: bundler
|
42
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,6 +159,7 @@ files:
|
|
173
159
|
- lib/cmdx/i18n.rb
|
174
160
|
- lib/cmdx/i18n/railtie.rb
|
175
161
|
- lib/cmdx/i18n/version.rb
|
162
|
+
- lib/generators/cmdx/i18n/locale_generator.rb
|
176
163
|
- lib/locales/af.yml
|
177
164
|
- lib/locales/ar.yml
|
178
165
|
- lib/locales/az.yml
|