cmdx-i18n 0.1.1 → 0.2.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 +3 -2
- data/CHANGELOG.md +8 -0
- data/README.md +10 -1
- data/lib/cmdx/i18n/version.rb +1 -1
- data/lib/cmdx/i18n.rb +4 -1
- data/lib/generators/cmdx/i18n/locale_generator.rb +41 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 330eb1ca9e8ca9a61a2073fa6efcbfe0b9b01f95938e2be371127e9d958e8550
|
4
|
+
data.tar.gz: 764bea625ce3edd4e85dc2d7273ef220a0c2d523598f9d9dcd8f35bc9874ed62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87f5e559e7bb2a45696596cfbb26b121db382dbc50789adb81839ae3aa7cebc067672908061a6c837f579a10cf26a6fadd35b99c7a35ed5202203c8e3e59be91
|
7
|
+
data.tar.gz: 725ae012e65190d74c691dfca4ba2668e3cea89590fd5950b4940bbb609324cbe5a1b7261fbc9831c030159e1702e922978b05f70554a5fcab563bcc07cfb27c
|
@@ -10,12 +10,13 @@ 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
15
|
|
16
16
|
## Technology Stack
|
17
17
|
- Ruby 3.4+
|
18
18
|
- RSpec 3.1+
|
19
|
+
- CMDx 1.6+
|
19
20
|
|
20
21
|
## Code Style and Structure
|
21
22
|
- Write concise, idiomatic Ruby code with accurate examples
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
|
7
7
|
## [TODO]
|
8
8
|
|
9
|
+
## [0.2.0] - 2025-08-24
|
10
|
+
|
11
|
+
### Added
|
12
|
+
- Generator to copy locales to `config/locales` in a Rails app
|
13
|
+
|
14
|
+
### Changes
|
15
|
+
- Fix railtie requirement issue
|
16
|
+
|
9
17
|
## [0.1.1] - 2025-08-23
|
10
18
|
|
11
19
|
### Changes
|
data/README.md
CHANGED
@@ -30,7 +30,16 @@ Or install it yourself as:
|
|
30
30
|
|
31
31
|
## Configuration
|
32
32
|
|
33
|
-
|
33
|
+
If the `I18n` gem is installed, `cmdx-i18n` locales are automatically loaded and are managed through the `I18n.available_locales` option.
|
34
|
+
|
35
|
+
Execute the following command to copy any locale to the applications `config/locales` directory:
|
36
|
+
|
37
|
+
```bash
|
38
|
+
rails generate cmdx:i18n:locale [LOCALE]
|
39
|
+
|
40
|
+
# Eg: generate french locale
|
41
|
+
rails generate cmdx:i18n:locale fr
|
42
|
+
```
|
34
43
|
|
35
44
|
## Locales
|
36
45
|
|
data/lib/cmdx/i18n/version.rb
CHANGED
data/lib/cmdx/i18n.rb
CHANGED
@@ -21,6 +21,9 @@ loader.inflector.inflect("cmdx" => "CMDx")
|
|
21
21
|
loader.ignore("#{__dir__}/locales")
|
22
22
|
loader.setup
|
23
23
|
|
24
|
+
# Conditionally load Rails components if Rails is available
|
25
|
+
require_relative "generators/cmdx/i18n/copy_generator" if defined?(Rails::Generators)
|
26
|
+
|
24
27
|
# Load the Railtie last after everything else is required so we don't
|
25
28
|
# need to load any CMDx::I18n components when we use this Railtie.
|
26
|
-
require_relative "
|
29
|
+
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.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- lib/cmdx/i18n.rb
|
174
174
|
- lib/cmdx/i18n/railtie.rb
|
175
175
|
- lib/cmdx/i18n/version.rb
|
176
|
+
- lib/generators/cmdx/i18n/locale_generator.rb
|
176
177
|
- lib/locales/af.yml
|
177
178
|
- lib/locales/ar.yml
|
178
179
|
- lib/locales/az.yml
|