gettext homelive

This commit is contained in:
shibao 2022-02-08 23:25:09 -05:00
parent f4d67dbeef
commit 185d8598da
4 changed files with 117 additions and 26 deletions

View File

@ -41,6 +41,8 @@ If you're multilingual, this project can use your translations! Visit
- When adding text, please use `gettext` macros to enable things to be
translated in the future. After adding `gettext` macros, run `mix format` in
order to add your new text strings to the files in `priv/gettext`.
- Existing domains: `"default"` (for anything general), `"prompts"`,
`"emails"`, and `"errors"`
- Before submitting a PR, please make sure all tests are passing using `mix test`.
And as always, thank you!

View File

@ -36,54 +36,62 @@ defmodule CanneryWeb.HomeLive do
~H"""
<div class="mx-auto px-8 sm:px-16 flex flex-col justify-center items-center text-center space-y-4 max-w-3xl">
<h1 class="title text-primary-500 text-2xl">
Welcome to Cannery
<%= gettext("Welcome to %{name}", name: "Cannery") %>
</h1>
<h2 class="title text-primary-500 text-lg">
The Self-hosted Ammo Tracker Website
<h2 class="title text-primary-500 text-lg">
<%= gettext("The self-hosted firearm tracker website") %>
</h2>
<hr class="hr" />
<ul class="flex flex-col space-y-4 text-center">
<li class="flex flex-col sm:flex-row justify-center items-center
space-y-2 sm:space-y-0 sm:space-x-2">
<li class="flex flex-col justify-center items-center
space-y-2">
<b class="whitespace-nowrap">
Easy to Use:
</b>
<p>Cannery lets you easily keep an eye on your ammo levels before and after range day</p>
</li>
<li class="flex flex-col sm:flex-row justify-center items-center
space-y-2 sm:space-y-0 sm:space-x-2">
<b class="whitespace-nowrap">
Secure:
<%= gettext("Easy to Use:") %>
</b>
<p>
Self-host your own instance, or use an instance from someone you trust.
Your data stays with you, period
<%= gettext("%{name} lets you easily keep an eye on your ammo levels before and after range day",
name: "Cannery"
) %>
</p>
</li>
<li class="flex flex-col sm:flex-row justify-center items-center
space-y-2 sm:space-y-0 sm:space-x-2">
<li class="flex flex-col justify-center items-center
space-y-2">
<b class="whitespace-nowrap">
Simple:
<%= gettext("Secure:") %>
</b>
<p>Access from any internet-capable device</p>
<p>
<%= gettext("Self-host your own instance, or use an instance from someone you trust.") %>
<%= gettext("Your data stays with you, period") %>
</p>
</li>
<li class="flex flex-col justify-center items-center
space-y-2">
<b class="whitespace-nowrap">
<%= gettext("Simple:") %>
</b>
<p>
<%= gettext("Access from any internet-capable device") %>
</p>
</li>
</ul>
<hr class="hr" />
<hr class="hr">
<ul class="flex flex-col space-y-2 text-center justify-center">
<h2 class="title text-primary-500 text-lg">
Instance Information
<h2 class="title text-primary-500 text-lg">
<%= gettext("Instance Information") %>
</h2>
<li class="flex flex-col justify-center space-x-2">
<b>Admins:</b>
<b>
<%= gettext("Admins:") %>
</b>
<p>
<%= if @admins |> Enum.empty?() do %>
<%= link("Sign up to setup Cannery!",
<%= link(dgettext("prompts", "Register to setup %{name}", name: "Cannery"),
class: "hover:underline",
to: Routes.user_registration_path(CanneryWeb.Endpoint, :new)
) %>
@ -104,8 +112,8 @@ defmodule CanneryWeb.HomeLive do
<p>
<%= Application.get_env(:cannery, CanneryWeb.Endpoint)[:registration]
|> case do
"public" -> "Public Signups"
_ -> "Invite Only"
"public" -> gettext("Public Signups")
_ -> gettext("Invite Only")
end %>
</p>
</li>

View File

@ -9,3 +9,68 @@
## effect: edit them in PO (.po) files instead.
msgid ""
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:55
msgid "%{name} lets you easily keep an eye on your ammo levels before and after range day"
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:76
msgid "Access from any internet-capable device"
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:85
msgid "Instance Information"
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:116
msgid "Invite Only"
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:115
msgid "Public Signups"
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:39
msgid "Welcome to %{name}"
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:67
msgid "Your data stays with you, period"
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:43
msgid "The self-hosted firearm tracker website"
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:90
msgid "Admins:"
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:52
msgid "Easy to Use:"
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:63
msgid "Secure:"
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:73
msgid "Simple:"
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:66
msgid "Self-host your own instance, or use an instance from someone you trust."
msgstr ""

16
priv/gettext/prompts.pot Normal file
View File

@ -0,0 +1,16 @@
## This file is a PO Template file.
##
## "msgid"s here are often extracted from source code.
## Add new translations manually only if they're dynamic
## translations that can't be statically extracted.
##
## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead.
msgid ""
msgstr ""
#, elixir-format, ex-autogen
#: lib/cannery_web/live/home_live.ex:94
msgid "Register to setup %{name}"
msgstr ""