Skip to content
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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Internationalization #28

wants to merge 2 commits into from

Conversation

joshmn
Copy link
Owner

@joshmn joshmn commented Aug 23, 2023

wip

@joshmn joshmn mentioned this pull request Aug 23, 2023
@afogel
Copy link
Collaborator

afogel commented Aug 24, 2023

this is 🔥

Copy link
Collaborator

@afogel afogel left a 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
Copy link
Collaborator

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
Copy link
Collaborator

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)),
Copy link
Collaborator

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"

@joshmn
Copy link
Owner Author

joshmn commented Aug 25, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants