Skip to content

Commit

Permalink
feat: added strand details pt-br translations
Browse files Browse the repository at this point in the history
  • Loading branch information
endoooo committed Jan 29, 2024
1 parent 54e54fc commit d3ebe3f
Show file tree
Hide file tree
Showing 20 changed files with 1,415 additions and 124 deletions.
36 changes: 19 additions & 17 deletions lib/lanttern_web/live/pages/strands/id/about_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ defmodule LantternWeb.StrandLive.AboutComponent do
<div class="container py-10 mx-auto lg:max-w-5xl">
<.markdown text={@strand.description} />
<div class="flex items-end justify-between gap-6">
<h3 class="mt-16 font-display font-black text-3xl">Goals</h3>
<h3 class="mt-16 font-display font-black text-3xl"><%= gettext("Goals") %></h3>
<div class="shrink-0 flex items-center gap-6">
<.collection_action
:if={@has_goal_position_change}
Expand All @@ -24,20 +24,22 @@ defmodule LantternWeb.StrandLive.AboutComponent do
phx-target={@myself}
class="font-bold"
>
Save updated order
<%= gettext("Save updated order") %>
</.collection_action>
<.collection_action
type="button"
icon_name="hero-plus-circle"
phx-click="new_goal"
phx-target={@myself}
>
Add strand goal
<%= gettext("Add strand goal") %>
</.collection_action>
</div>
</div>
<p class="mt-4">
Under the hood, goals in Lanttern are defined by assessment points linked directly to the strand — when adding goals, we are adding assessment points which, in turn, hold the curriculum items we'll want to assess along the strand course.
<%= gettext(
"Under the hood, goals in Lanttern are defined by assessment points linked directly to the strand — when adding goals, we are adding assessment points which, in turn, hold the curriculum items we'll want to assess along the strand course."
) %>
</p>
<div :for={{curriculum_item, i} <- @curriculum_items} class="mt-6">
<div class="flex items-stretch gap-6 p-6 rounded bg-white shadow-lg">
Expand All @@ -52,15 +54,15 @@ defmodule LantternWeb.StrandLive.AboutComponent do
phx-click={JS.push("edit_goal", value: %{id: curriculum_item.assessment_point_id})}
phx-target={@myself}
>
Edit
<%= gettext("Edit") %>
</.button>
</div>
<p class="mt-4"><%= curriculum_item.name %></p>
</div>
<div class="shrink-0 flex flex-col justify-center gap-2">
<.icon_button
type="button"
sr_text="Move curriculum item up"
sr_text={gettext("Move curriculum item up")}
name="hero-chevron-up-mini"
theme="ghost"
rounded
Expand All @@ -71,7 +73,7 @@ defmodule LantternWeb.StrandLive.AboutComponent do
/>
<.icon_button
type="button"
sr_text="Move curriculum item down"
sr_text={gettext("Move curriculum item down")}
name="hero-chevron-down-mini"
theme="ghost"
rounded
Expand All @@ -89,7 +91,7 @@ defmodule LantternWeb.StrandLive.AboutComponent do
show={true}
on_cancel={JS.patch(~p"/strands/#{@strand}?tab=about")}
>
<:title>Strand Goal</:title>
<:title><%= gettext("Strand Goal") %></:title>
<.live_component
module={AssessmentPointFormComponent}
id={Map.get(@assessment_point, :id) || :new}
Expand All @@ -108,10 +110,10 @@ defmodule LantternWeb.StrandLive.AboutComponent do
type="button"
phx-click="delete_assessment_point_and_entries"
phx-target={@myself}
data-confirm="Are you sure?"
data-confirm={gettext("Are you sure?")}
class="mt-4 font-display font-bold underline"
>
Understood. Delete anyway
<%= gettext("Understood. Delete anyway") %>
</button>
</div>
<button
Expand All @@ -120,7 +122,7 @@ defmodule LantternWeb.StrandLive.AboutComponent do
phx-target={@myself}
class="shrink-0"
>
<span class="sr-only">dismiss</span>
<span class="sr-only"><%= gettext("dismiss") %></span>
<.icon name="hero-x-mark" />
</button>
</div>
Expand All @@ -130,9 +132,9 @@ defmodule LantternWeb.StrandLive.AboutComponent do
theme="ghost"
phx-click="delete_assessment_point"
phx-target={@myself}
data-confirm="Are you sure?"
data-confirm={gettext("Are you sure?")}
>
Delete
<%= gettext("Delete") %>
</.button>
</:actions_left>
<:actions>
Expand All @@ -141,10 +143,10 @@ defmodule LantternWeb.StrandLive.AboutComponent do
theme="ghost"
phx-click={JS.exec("data-cancel", to: "#assessment-point-form-overlay")}
>
Cancel
<%= gettext("Cancel") %>
</.button>
<.button type="submit" form="assessment-point-form" phx-disable-with="Saving...">
Save
<.button type="submit" form="assessment-point-form" phx-disable-with={gettext("Saving...")}>
<%= gettext("Save") %>
</.button>
</:actions>
</.slide_over>
Expand Down Expand Up @@ -210,7 +212,7 @@ defmodule LantternWeb.StrandLive.AboutComponent do
{:error, _changeset} ->
# we may have more error types, but for now we are handling only this one
message =
"This goal already have some entries. Deleting it will cause data loss."
gettext("This goal already have some entries. Deleting it will cause data loss.")

{:noreply, socket |> assign(:delete_assessment_point_error, message)}
end
Expand Down
28 changes: 15 additions & 13 deletions lib/lanttern_web/live/pages/strands/id/activities_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule LantternWeb.StrandLive.ActivitiesComponent do
<div class="container py-10 mx-auto lg:max-w-5xl">
<div class="flex items-end justify-between mb-4">
<h3 class="font-display font-bold text-lg">
Strand activities
<%= gettext("Strand activities") %>
</h3>
<div class="shrink-0 flex items-center gap-6">
<.collection_action
Expand All @@ -22,20 +22,20 @@ defmodule LantternWeb.StrandLive.ActivitiesComponent do
phx-click={JS.exec("data-show", to: "#strand-activities-order-overlay")}
icon_name="hero-arrows-up-down"
>
Reorder
<%= gettext("Reorder") %>
</.collection_action>
<.collection_action
type="link"
patch={~p"/strands/#{@strand}/new_activity"}
icon_name="hero-plus-circle"
>
Create new activity
<%= gettext("Create new activity") %>
</.collection_action>
</div>
</div>
<%= if @activities_count == 0 do %>
<div class="p-10 rounded shadow-xl bg-white">
<.empty_state>No activities for this strand yet</.empty_state>
<.empty_state><%= gettext("No activities for this strand yet") %></.empty_state>
</div>
<% else %>
<div phx-update="stream" id="strand-activities" class="flex flex-col gap-4">
Expand All @@ -53,7 +53,9 @@ defmodule LantternWeb.StrandLive.ActivitiesComponent do
<span class="underline"><%= activity.name %></span>
</.link>
<div class="shrink-0 flex gap-2">
<.badge :for={subject <- activity.subjects}><%= subject.name %></.badge>
<.badge :for={subject <- activity.subjects}>
<%= Gettext.dgettext(LantternWeb.Gettext, "taxonomy", subject.name) %>
</.badge>
</div>
</div>
<div class="line-clamp-6">
Expand All @@ -68,7 +70,7 @@ defmodule LantternWeb.StrandLive.ActivitiesComponent do
show={true}
on_cancel={JS.patch(~p"/strands/#{@strand}?tab=activities")}
>
<:title>New activity</:title>
<:title><%= gettext("New activity") %></:title>
<.live_component
module={ActivityFormComponent}
id={:new}
Expand All @@ -84,10 +86,10 @@ defmodule LantternWeb.StrandLive.ActivitiesComponent do
theme="ghost"
phx-click={JS.exec("data-cancel", to: "#activity-form-overlay")}
>
Cancel
<%= gettext("Cancel") %>
</.button>
<.button type="submit" form="activity-form">
Save
<%= gettext("Save") %>
</.button>
</:actions>
</.slide_over>
Expand All @@ -108,7 +110,7 @@ defmodule LantternWeb.StrandLive.ActivitiesComponent do
def reorder_overlay(assigns) do
~H"""
<.slide_over id="strand-activities-order-overlay">
<:title>Strand Activities Order</:title>
<:title><%= gettext("Strand Activities Order") %></:title>
<ol>
<li
:for={{activity, i} <- @sortable_activities}
Expand All @@ -121,7 +123,7 @@ defmodule LantternWeb.StrandLive.ActivitiesComponent do
<div class="shrink-0 flex flex-col gap-2">
<.icon_button
type="button"
sr_text="Move activity up"
sr_text={gettext("Move activity up")}
name="hero-chevron-up-mini"
theme="ghost"
rounded
Expand All @@ -132,7 +134,7 @@ defmodule LantternWeb.StrandLive.ActivitiesComponent do
/>
<.icon_button
type="button"
sr_text="Move activity down"
sr_text={gettext("Move activity down")}
name="hero-chevron-down-mini"
theme="ghost"
rounded
Expand All @@ -150,10 +152,10 @@ defmodule LantternWeb.StrandLive.ActivitiesComponent do
theme="ghost"
phx-click={JS.exec("data-cancel", to: "#strand-activities-order-overlay")}
>
Cancel
<%= gettext("Cancel") %>
</.button>
<.button type="button" phx-click="save_order" phx-target={@myself}>
Save
<%= gettext("Save") %>
</.button>
</:actions>
</.slide_over>
Expand Down
16 changes: 8 additions & 8 deletions lib/lanttern_web/live/pages/strands/id/assessment_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmodule LantternWeb.StrandLive.AssessmentComponent do
<div class="flex items-end justify-between gap-6">
<%= if @classes do %>
<p class="font-display font-bold text-2xl">
Viewing
<%= gettext("Viewing") %>
<button
type="button"
class="inline text-left underline hover:text-ltrn-subtle"
Expand All @@ -35,22 +35,22 @@ defmodule LantternWeb.StrandLive.AssessmentComponent do
class="underline hover:text-ltrn-subtle"
phx-click={JS.exec("data-show", to: "#classes-filter-overlay")}
>
Select a class
<%= gettext("Select a class") %>
</button>
to view students assessments
<%= gettext("to view students assessments") %>
</p>
<% end %>
</div>
<%!-- if no assessment points, render empty state --%>
<div :if={@assessment_points_count == 0} class="p-10 mt-4 rounded shadow-xl bg-white">
<.empty_state>No assessment points for this strand yet</.empty_state>
<.empty_state><%= gettext("No assessment points for this strand yet") %></.empty_state>
</div>
<%!-- if no class filter is select, just render assessment points --%>
<div
:if={!@classes && @assessment_points_count > 0}
class="p-10 mt-4 rounded shadow-xl bg-white"
>
<p class="mb-6 font-bold text-ltrn-subtle">Current assessment points</p>
<p class="mb-6 font-bold text-ltrn-subtle"><%= gettext("Current assessment points") %></p>
<ol phx-update="stream" id="assessment-points-no-class" class="flex flex-col gap-4">
<li
:for={{dom_id, {assessment_point, i}} <- @streams.assessment_points}
Expand Down Expand Up @@ -99,7 +99,7 @@ defmodule LantternWeb.StrandLive.AssessmentComponent do
params={@params}
/>
<.slide_over id="classes-filter-overlay">
<:title>Classes</:title>
<:title><%= gettext("Classes") %></:title>
<.live_component
module={ClassFilterFormComponent}
id={:filter}
Expand All @@ -119,14 +119,14 @@ defmodule LantternWeb.StrandLive.AssessmentComponent do
theme="ghost"
phx-click={JS.exec("data-cancel", to: "#classes-filter-overlay")}
>
Cancel
<%= gettext("Cancel") %>
</.button>
<.button
type="submit"
form="class-filter-form"
phx-click={JS.exec("data-cancel", to: "#classes-filter-overlay")}
>
Select
<%= gettext("Select") %>
</.button>
</:actions>
</.slide_over>
Expand Down
24 changes: 14 additions & 10 deletions lib/lanttern_web/live/pages/strands/id/notes_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule LantternWeb.StrandLive.NotesComponent do
name={@form[:description].name}
value={@form[:description].value}
errors={@form[:description].errors}
label="Add your notes..."
label={gettext("Add your notes...")}
rows="10"
>
<:actions_left :if={@note}>
Expand All @@ -25,17 +25,17 @@ defmodule LantternWeb.StrandLive.NotesComponent do
theme="ghost"
phx-click="delete"
phx-target={@myself}
data-confirm="Are you sure?"
data-confirm={gettext("Are you sure?")}
>
Delete note
<%= gettext("Delete note") %>
</.button>
</:actions_left>
<:actions>
<.button type="button" theme="ghost" phx-click="cancel_edit" phx-target={@myself}>
Cancel
<%= gettext("Cancel") %>
</.button>
<.button type="submit">
Save
<%= gettext("Save") %>
</.button>
</:actions>
</.textarea_with_actions>
Expand All @@ -44,27 +44,31 @@ defmodule LantternWeb.StrandLive.NotesComponent do
<% else %>
<%= if @note do %>
<div class="flex items-center justify-between mb-10">
<h3 class="font-display font-bold text-xl">My strand notes (visible only to you)</h3>
<h3 class="font-display font-bold text-xl">
<%= gettext("My strand notes (visible only to you)") %>
</h3>
<.button type="button" theme="ghost" phx-click="edit" phx-target={@myself}>
Edit
<%= gettext("Edit") %>
</.button>
</div>
<.markdown text={@note.description} />
<% else %>
<.empty_state>You don't have any notes for this strand yet</.empty_state>
<.empty_state><%= gettext("You don't have any notes for this strand yet") %></.empty_state>
<div class="mt-6 text-center">
<button
type="button"
class="font-display font-black underline"
phx-click="edit"
phx-target={@myself}
>
Add a strand note
<%= gettext("Add a strand note") %>
</button>
</div>
<% end %>
<%= if length(@activities_notes) > 0 do %>
<h4 class="mt-10 font-display font-bold text-lg">Other notes in this strand</h4>
<h4 class="mt-10 font-display font-bold text-lg">
<%= gettext("Other notes in this strand") %>
</h4>
<div :for={note <- @activities_notes} class="mt-6">
<.link
navigate={~p"/strands/activity/#{note.activity.id}?tab=notes"}
Expand Down
6 changes: 3 additions & 3 deletions lib/lanttern_web/live/pages/strands/id/strand_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ defmodule LantternWeb.StrandLive do
case LearningContext.get_strand(id, preloads: [:subjects, :years]) do
strand when is_nil(strand) ->
socket
|> put_flash(:error, "Couldn't find strand")
|> put_flash(:error, gettext("Couldn't find strand"))
|> redirect(to: ~p"/strands")

strand ->
Expand All @@ -101,15 +101,15 @@ defmodule LantternWeb.StrandLive do
{:ok, _strand} ->
{:noreply,
socket
|> put_flash(:info, "Strand deleted")
|> put_flash(:info, gettext("Strand deleted"))
|> push_navigate(to: ~p"/strands")}

{:error, _changeset} ->
{:noreply,
socket
|> put_flash(
:error,
"Strand has linked activities. Deleting it would cause some data loss."
gettext("Strand has linked activities. Deleting it would cause some data loss.")
)}
end
end
Expand Down
Loading

0 comments on commit d3ebe3f

Please sign in to comment.