Skip to content

Commit

Permalink
chore: starting to translate things
Browse files Browse the repository at this point in the history
  • Loading branch information
kainlite committed Sep 19, 2024
1 parent 03a7e8e commit 8d129c1
Show file tree
Hide file tree
Showing 37 changed files with 1,954 additions and 266 deletions.
9 changes: 6 additions & 3 deletions lib/tr_web/components/comment.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ defmodule TrWeb.CommentComponent do

def render_comment(assigns) do
~H"""
<% body = if @comment.approved, do: @comment.body, else: "Comment hidden, awaiting moderation..." %>
<% body =
if @comment.approved, do: @comment.body, else: gettext("Comment hidden, awaiting moderation...") %>
<li class={@classes}>
<div class="flex">
<img class="h-12 rounded-full mr-4" src={@avatar_url} alt="User Avatar" />
Expand Down Expand Up @@ -52,7 +53,7 @@ defmodule TrWeb.CommentComponent do
<% end %>
<.simple_form for={@form} id="comment_form" phx-submit="save">
<.error :if={@check_errors}>
Oops, something went wrong! Please check the errors below.
<%= gettext("Oops, something went wrong! Please check the errors below.") %>
</.error>
<.input field={@form[:body]} type="textarea" label="Message" required />
Expand All @@ -65,7 +66,9 @@ defmodule TrWeb.CommentComponent do
<.input field={@form[:slug]} type="hidden" id="hidden_post_slug" value={@post.id} />
<:actions>
<.button id="comment_submit" phx-disable-with="Saving..." class="w-full">Send</.button>
<.button id="comment_submit" phx-disable-with={gettext("Saving...")} class="w-full">
Send
</.button>
</:actions>
</.simple_form>
"""
Expand Down
8 changes: 4 additions & 4 deletions lib/tr_web/components/layouts/app.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
href={~p"/admin/dashboard?comments=unapproved"}
class="text-[1.25rem] leading-6 text-[#0069d9] dark:text-[rgb(253 79 0 / var(--tw-text-opacity))] font-semibold hover:text-zinc-700"
>
Dashboard
<%= gettext("Dashboard") %>
</.link>
</li>
<% end %>
Expand All @@ -57,7 +57,7 @@
method="delete"
class="text-[1.25rem] leading-6 text-[#0069d9] dark:text-[rgb(253 79 0 / var(--tw-text-opacity))] font-semibold hover:text-zinc-700"
>
Log out
<%= gettext("Log out") %>
</.link>
</li>
<% else %>
Expand All @@ -66,15 +66,15 @@
href={~p"/users/log_in"}
class="text-[1.25rem] leading-6 text-[#0069d9] dark:text-[rgb(253 79 0 / var(--tw-text-opacity))] font-semibold hover:text-zinc-700"
>
Log in
<%= gettext("Log in") %>
</.link>
</li>
<li class="order-60">
<.link
href={~p"/users/register"}
class="text-[1.25rem] leading-6 text-[#0069d9] dark:text-[rgb(253 79 0 / var(--tw-text-opacity))] font-semibold hover:text-zinc-700"
>
Register
<%= gettext("Register") %>
</.link>
</li>
<% end %>
Expand Down
6 changes: 5 additions & 1 deletion lib/tr_web/components/layouts/root.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} />
<% description =
"Red Beard Team offers expert fractional DevOps services specializing in Linux, Kubernetes, AWS, Terraform, Docker, and more. Transform your infrastructure with our tailored solutions. Explore insights, tutorials, and experiments across the tech landscape." %>
gettext(
"Red Beard Team offers expert fractional DevOps services specializing in Linux, Kubernetes, AWS,
Terraform, Docker, and more. Transform your infrastructure with our tailored solutions. Explore insights,
tutorials, and experiments across the tech landscape."
) %>
<meta name="description" content={description} />
<meta property="og:title" content={assigns[:page_title] || "Red Beard Team"} />
<meta property="og:description" content={description} />
Expand Down
2 changes: 1 addition & 1 deletion lib/tr_web/components/post.ex
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ defmodule TrWeb.PostComponent do
navigate={~p"/blog/#{@post.id}"}
class="mt-4 inline-block text-blue-500 float-right text-base font-semibold"
>
Read more...
<%= gettext("Read more...") %>
</.link>
</div>
<div class="absolute bottom-0 left-6">
Expand Down
6 changes: 4 additions & 2 deletions lib/tr_web/controllers/error_html/404.html.heex
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<h3 class="font-bold">
It seems we cannot find the page you are looking for, but please check out the following tags and latest
articles...
<%= gettext(
"It seems we cannot find the page you are looking for, but please check out the following tags and latest
articles..."
) %>
</h3>
<div class="mx-auto">
<ul class="list-none flex flex-row flex-wrap">
Expand Down
6 changes: 4 additions & 2 deletions lib/tr_web/controllers/error_html/500.html.heex
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<h3 class="font-bold">
It seems we cannot find the page you are looking for, but please check out the following tags and latest
articles...
<%= gettext(
"It seems we cannot find the page you are looking for, but please check out the following tags and latest
articles..."
) %>
</h3>
<div class="mx-auto">
<ul class="list-none flex flex-row flex-wrap">
Expand Down
8 changes: 5 additions & 3 deletions lib/tr_web/controllers/error_html/root.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} />
<% description =
"Welcome to the Techsquad and Red Beard blog! This page is dedicated to documenting and exploring various
technologies. Our blog is hosted on a k3s cluster in OCI, powered by Elixir and Phoenix. Dive in to discover
insights, tutorials, and experiments across the tech landscape." %>
gettext(
"Welcome to the Techsquad and Red Beard blog! This page is dedicated to documenting and exploring various
technologies. Our blog is hosted on a k3s cluster in OCI, powered by Elixir and Phoenix. Dive in to
discover insights, tutorials, and experiments across the tech landscape."
) %>
<meta name="description" content={description} />
<meta property="og:title" content={assigns[:page_title] || "Red Beard Team"} />
<meta property="og:description" content={description} />
Expand Down
2 changes: 1 addition & 1 deletion lib/tr_web/controllers/github_auth_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule TrWeb.GithubAuthController do
|> redirect(to: ~p"/blog", profile: profile)
else
conn
|> put_flash(:error, "Email not verified")
|> put_flash(:error, gettext("Email not verified"))
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/tr_web/controllers/google_auth_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ defmodule TrWeb.GoogleAuthController do
|> redirect(to: ~p"/blog", profile: profile)
else
conn
|> put_flash(:error, "Email not verified")
|> put_flash(:error, gettext("Email not verified"))
end
end

Expand Down
7 changes: 5 additions & 2 deletions lib/tr_web/controllers/page_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ defmodule TrWeb.PageController do
|> put_resp_content_type("application/feed+json")
|> json(%{
version: "https://jsonfeed.org/version/1.1",
title: "Fractional DevOps Services | Linux, Kubernetes & AWS Experts | Red Beard Team",
title:
gettext("Fractional DevOps Services | Linux, Kubernetes & AWS Experts | Red Beard Team"),
home_page_url: "https://redbeard.team/",
feed_url: "https://redbeard.team/index.json",
description:
"Red Beard Team offers expert fractional DevOps services specializing in Linux, Kubernetes, AWS, Terraform, Docker, and more. Transform your infrastructure with our tailored solutions. Explore insights, tutorials, and experiments across the tech landscape.",
gettext(
"Red Beard Team offers expert fractional DevOps services specializing in Linux, Kubernetes, AWS, Terraform, Docker, and more. Transform your infrastructure with our tailored solutions. Explore insights, tutorials, and experiments across the tech landscape."
),
favicon: "https://redbeard.team/favicon.ico",
language: "en-US",
items:
Expand Down
6 changes: 4 additions & 2 deletions lib/tr_web/controllers/page_xml/index.xml.eex
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Fractional DevOps Services | Linux, Kubernetes & AWS Experts | Red Beard Team</title>
<title><%= gettext "Fractional DevOps Services | Linux, Kubernetes & AWS Experts | Red Beard Team" %></title>
<link><%= url(~p"/blog") %></link>
<atom:link href="<%= ~p"/index.xml" %>" rel="self" type="application/rss+xml" />
<description>Red Beard Team offers expert fractional DevOps services specializing in Linux, Kubernetes, AWS, Terraform, Docker, and more. Transform your infrastructure with our tailored solutions. Explore insights, tutorials, and experiments across the tech landscape.
<description><%= gettext("Red Beard Team offers expert fractional DevOps services specializing in Linux, Kubernetes,
AWS, Terraform, Docker, and more. Transform your infrastructure with our tailored solutions. Explore insights,
tutorials, and experiments across the tech landscape.") %>
</description>
<language>en</language>
<copyright>Copyright <%= DateTime.utc_now.year %> Red Beard Team </copyright>
Expand Down
12 changes: 6 additions & 6 deletions lib/tr_web/controllers/user_session_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ defmodule TrWeb.UserSessionController do
alias TrWeb.UserAuth

def create(conn, %{"_action" => "registered"} = params) do
create(conn, params, "Account created successfully!")
create(conn, params, gettext("Account created successfully!"))
end

def create(conn, %{"_action" => "password_updated"} = params) do
conn
|> put_session(:user_return_to, ~p"/users/settings")
|> create(params, "Password updated successfully!")
|> create(params, gettext("Password updated successfully!"))
end

def create(conn, params) do
create(conn, params, "Welcome back!")
create(conn, params, gettext("Welcome back!"))
end

defp create(conn, %{"user" => user_params}, info) do
Expand All @@ -29,20 +29,20 @@ defmodule TrWeb.UserSessionController do

{:error, :bad_username_or_password} ->
conn
|> put_flash(:error, "Invalid email or password")
|> put_flash(:error, gettext("Invalid email or password"))
|> put_flash(:email, String.slice(email, 0, 160))
|> redirect(to: ~p"/users/log_in")

{:error, :not_confirmed} ->
conn
|> put_flash(:error, "Please verify your account")
|> put_flash(:error, gettext("Please verify your account"))
|> redirect(to: ~p"/users/log_in")
end
end

def delete(conn, _params) do
conn
|> put_flash(:info, "Logged out successfully.")
|> put_flash(:info, gettext("Logged out successfully."))
|> UserAuth.log_out_user()
end
end
Loading

0 comments on commit 8d129c1

Please sign in to comment.