diff --git a/README.md b/README.md index ea8d177..72fc9f7 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # AlchemyCMS Translations -Translations files for AlchemyCMS 6.0 and above. +Translations files for AlchemyCMS 7.0 and above. ## Alchemy version -For a Alchemy 5.3 compatible version use v2.3.1 or the `2.3-stable` branch. +- For a Alchemy 6.1 compatible version use v3.2.0 or the `3.2-stable` branch. +- For a Alchemy 5.3 compatible version use v2.3.1 or the `2.3-stable` branch. ## Installation diff --git a/alchemy_i18n.gemspec b/alchemy_i18n.gemspec index 5cb5db1..715d5da 100644 --- a/alchemy_i18n.gemspec +++ b/alchemy_i18n.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.files = Dir["{app,locales,lib,vendor}/**/*", "CHANGELOG.md", "LICENSE", "README.md"] - s.add_dependency "alchemy_cms", [">= 6.0.0", "< 8"] + s.add_dependency "alchemy_cms", [">= 7.0.4", "< 8"] s.add_dependency "rails-i18n" s.add_development_dependency "github_changelog_generator" diff --git a/lib/alchemy_i18n/engine.rb b/lib/alchemy_i18n/engine.rb index b7e392f..d3e6cf7 100644 --- a/lib/alchemy_i18n/engine.rb +++ b/lib/alchemy_i18n/engine.rb @@ -5,6 +5,10 @@ class Engine < ::Rails::Engine pattern = locales.empty? ? "*" : "{#{locales.join ","}}" files = Dir[root.join("locales", "alchemy.#{pattern}.yml")] I18n.load_path.concat(files) + locales.each do |locale| + Alchemy.importmap.pin "flatpickr/#{locale}.js", to: "https://ga.jspm.io/npm:flatpickr@4.6.13/dist/l10n/#{locale}.js" + Alchemy.admin_js_imports << "flatpickr/#{locale}.js" + end end end end diff --git a/lib/generators/alchemy_i18n/install/install_generator.rb b/lib/generators/alchemy_i18n/install/install_generator.rb index bb5273d..f6e812e 100644 --- a/lib/generators/alchemy_i18n/install/install_generator.rb +++ b/lib/generators/alchemy_i18n/install/install_generator.rb @@ -37,24 +37,6 @@ def append_manifest end end - def append_pack - app_root = Rails.root - config_file = app_root.join("config", "webpacker.yml") - if config_file.exist? - webpack_config = YAML.load_file(config_file)[Rails.env] - pack = app_root.join( - webpack_config["source_path"], - webpack_config["source_entry_path"], - "alchemy/admin.js" - ) - else - pack = app_root.join("app/javascript/alchemy_admin.js") - end - additional_locales.each { |locale| append_file pack, <<~PACK } - import "flatpickr/dist/l10n/#{locale}.js" - PACK - end - def add_rails_i18n environment do "config.i18n.available_locales = #{locales.inspect}"