-
Notifications
You must be signed in to change notification settings - Fork 0
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
Adds localization features #240
Conversation
Container Scanning Status: ✅ Success
|
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.
This looks great!!! I left a few comments.
Also I'd love to look together, I don't understand why we have set_locale_hook
as well as locale_plug
and how they interact. I'm hoping you can show me.
<lux-menu-bar | ||
type="main-menu" | ||
v-bind:menu-items={"[ | ||
{name: '#{gettext("Language")}', component: 'Language', children: [ | ||
{name: 'English', component: 'English', href: '?locale=en'}, | ||
{name: 'Español', component: 'Español', href: '?locale=es'}, | ||
{name: 'Português do Brasil', component: 'Português do Brasil', href: '?locale=pt-BR'} |
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.
Should we take out the Brazilian until we get the translations in place?
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.
I think it's fine to leave it. It would be fairly easy to add the Brasilian translations if we wanted to make sure that option works.
alias DpulCollections.Solr | ||
alias DpulCollectionsWeb.Live.Helpers | ||
|
||
# on_mount SetLocaleHook |
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.
old comment?
<p class="text-xl text-center"> | ||
We invite you to be inspired by our globally diverse collections of <%= @item_count %> Ephemera items. We can't wait to see how you use these materials to support your unique research. | ||
<%= gettext("We invite you to be inspired by our globally diverse collections of") %> <%= @item_count %> | ||
<%= gettext( |
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.
Does the break between tags render as a newline?
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.
It does. The text is very long. I usually have soft wrapping on in my editor, but I try to avoid lines that are that long. I am not tied to having a line break here.
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.
There's a max width style on it so I don't think it will ever get too long on the actual screen.
|
||
#: lib/dpul_collections_web/components/core_components.ex:85 | ||
#, elixir-autogen, elixir-format | ||
msgid "We can't find the internet" |
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.
this one is my favorite
#: lib/dpul_collections_web/live/search_live.ex:186 | ||
#, elixir-autogen, elixir-format | ||
msgid "Previous" | ||
msgstr "anterior" |
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.
should this one be capitalized?
@@ -6,7 +6,7 @@ defmodule DpulCollectionsWeb.HomeLiveTest do | |||
test "GET /", %{conn: conn} do | |||
count = DpulCollections.Solr.document_count() | |||
conn = get(conn, ~p"/") | |||
assert html_response(conn, 200) =~ "#{count} Ephemera items" | |||
assert html_response(conn, 200) =~ "#{count}\n Ephemera items" |
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.
I think it would be better if we could not have this newline. Relevant to my earlier comment
@@ -0,0 +1,58 @@ | |||
defmodule DpulCollectionsWeb.SetLocaleHookTest do | |||
use ExUnit.Case, async: true | |||
# import Phoenix.LiveView |
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.
old?
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.
@sdellis one more
@@ -0,0 +1,13 @@ | |||
defmodule DpulCollectionsWeb.SetLocaleHook do |
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.
Could we add a module doc that says something like, "set up locale for front-end use"
defmodule DpulCollectionsWeb.LocalePlug do | ||
@moduledoc """ | ||
Fetch locale and set it for the specified Gettext backend. | ||
|
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 add something like, "sets it in the session so the front end can use it"
#: lib/dpul_collections_web/live/search_live.ex:69 | ||
#, elixir-autogen, elixir-format, fuzzy | ||
msgid "Search Results" | ||
msgstr "Search" |
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.
Remove this one
#: lib/dpul_collections_web/live/search_live.ex:75 | ||
#, elixir-autogen, elixir-format | ||
msgid "Search" | ||
msgstr "Search" |
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.
remove?
…parameter to every liveview page
…anguage header and put the locale in the session
7a37b52
to
3f2bfa1
Compare
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.
🎉
still working out how to pass the locale parameter to every liveview page
Ref: #123