-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Internationalization #28
base: main
Are you sure you want to change the base?
Conversation
this is 🔥 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks great. one small thing to update and a few small questions about organizing the custom i18n config module.
BACKEND | ||
end | ||
|
||
def available_locales |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have two methods, available_locales
and available_locales_set
? Why not consolidate into a single available_locales
method?
module AhoyCaptain | ||
class I18nConfig < ::I18n::Config | ||
BACKEND = I18n::Backend::Simple.new | ||
AVAILABLE_LOCALES = AhoyCaptain::Engine.root.join("config/locales/ahoy_captain").glob("*.yml").map { |path| File.basename(path, ".yml").to_sym }.uniq |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is logic we want to add to the initialize
method rather than keeping in a constant?
(link_to "Custom period", "javascript:customComparisonModal.showModal()", class: selected(:custom)), | ||
(link_to "Year-over-year", AhoyCaptain::Engine.routes.url_helpers.root_path(**helpers.search_params.merge(comparison: :year)), class: selected(:year)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you're already updating, change hardcoded strings to an i18n
lookup, e.g., "Year-over-year" -> ".year-over-year"
have at it! it's why i assigned this to you :)
fwiw: i don't have any i18n experience; i don't know best practices,
conventions, etc. most of the setup is stolen from ben as mentioned in a
comment.
…On Fri, Aug 25, 2023 at 4:00 AM Ariel ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Overall looks great. one small thing to update and a few small questions
about organizing the custom i18n config module.
------------------------------
In app/models/ahoy_captain/i18n_config.rb
<#28 (comment)>:
> @@ -0,0 +1,23 @@
+module AhoyCaptain
+ class I18nConfig < ::I18n::Config
+ BACKEND = I18n::Backend::Simple.new
+ AVAILABLE_LOCALES = AhoyCaptain::Engine.root.join("config/locales/ahoy_captain").glob("*.yml").map { |path| File.basename(path, ".yml").to_sym }.uniq
+ AVAILABLE_LOCALES_SET = AVAILABLE_LOCALES.inject(Set.new) { |set, locale| set << locale.to_s << locale.to_sym }
+
+ def backend
+ BACKEND
+ end
+
+ def available_locales
Why do we have two methods, available_locales and available_locales_set?
Why not consolidate into a single available_locales method?
------------------------------
In app/models/ahoy_captain/i18n_config.rb
<#28 (comment)>:
> @@ -0,0 +1,23 @@
+module AhoyCaptain
+ class I18nConfig < ::I18n::Config
+ BACKEND = I18n::Backend::Simple.new
+ AVAILABLE_LOCALES = AhoyCaptain::Engine.root.join("config/locales/ahoy_captain").glob("*.yml").map { |path| File.basename(path, ".yml").to_sym }.uniq
Maybe this is logic we want to add to the initialize method rather than
keeping in a constant?
------------------------------
In app/components/ahoy_captain/comparison_link_component.rb
<#28 (comment)>:
> (link_to "Custom period", "javascript:customComparisonModal.showModal()", class: selected(:custom)),
+ (link_to "Year-over-year", AhoyCaptain::Engine.routes.url_helpers.root_path(**helpers.search_params.merge(comparison: :year)), class: selected(:year)),
if you're already updating, change hardcoded strings to an i18n lookup,
e.g., "Year-over-year" -> ".year-over-year"
—
Reply to this email directly, view it on GitHub
<#28 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPPFEG7VQHJSK73OVFOS2TXXBSS3ANCNFSM6AAAAAA33VB7E4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
any progress on this front? i see that this gem has not been updated in a year. |
wip