-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div class="dropdown dropdown-end" data-controller='dropdown-label'> | ||
<label | ||
tabindex="0" | ||
class="cursor-pointer flex <%= classes %>" | ||
data-action='click->dropdown-label#removeHidden' | ||
> | ||
<span data-dropdown-label-target="label"><%= title %></span> | ||
|
||
</label> | ||
<ul class="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-52" data-dropdown-label-target="close"> | ||
<% links.each do |link| %> | ||
<li data-action="click->dropdown-label#setLabel"> | ||
<%= link %> | ||
<li> | ||
<% end %> | ||
</ul> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this is logic we want to add to the |
||
AVAILABLE_LOCALES_SET = AVAILABLE_LOCALES.inject(Set.new) { |set, locale| set << locale.to_s << locale.to_sym } | ||
|
||
def backend | ||
BACKEND | ||
end | ||
|
||
def available_locales | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we have two methods, |
||
AVAILABLE_LOCALES | ||
end | ||
|
||
def available_locales_set | ||
AVAILABLE_LOCALES_SET | ||
end | ||
|
||
def default_locale | ||
AhoyCaptain.config.locale | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
en: | ||
ahoy_captain: | ||
tiles: | ||
titles: | ||
top_sources: Top Sources | ||
stats: | ||
titles: | ||
unique_visits: Unique Visits | ||
|
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"