forked from shibao/cannery
		
	gettext topbar
This commit is contained in:
		| @@ -41,8 +41,9 @@ 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"` | ||||
|   - Existing domains: `"default"` (for anything general), `"prompts"` (as a | ||||
|     result of the user doing an action), `"actions"` (actions that the user can | ||||
|     take), `"emails"`, and `"errors"` | ||||
| - Before submitting a PR, please make sure all tests are passing using `mix test`. | ||||
|  | ||||
| And as always, thank you! | ||||
|   | ||||
| @@ -32,32 +32,32 @@ defmodule CanneryWeb.Component.Topbar do | ||||
|             space-x-4 text-lg text-white text-ellipsis"> | ||||
|             <%= if @current_user do %> | ||||
|               <li> | ||||
|                 <%= link("Tags", | ||||
|                 <%= link(gettext("Tags"), | ||||
|                   class: "hover:underline", | ||||
|                   to: Routes.tag_index_path(CanneryWeb.Endpoint, :index) | ||||
|                 ) %> | ||||
|               </li> | ||||
|               <li> | ||||
|                 <%= link("Containers", | ||||
|                 <%= link(gettext("Containers"), | ||||
|                   class: "hover:underline", | ||||
|                   to: Routes.container_index_path(CanneryWeb.Endpoint, :index) | ||||
|                 ) %> | ||||
|               </li> | ||||
|               <li> | ||||
|                 <%= link("Ammo", | ||||
|                 <%= link(gettext("Ammo"), | ||||
|                   class: "hover:underline", | ||||
|                   to: Routes.ammo_type_index_path(CanneryWeb.Endpoint, :index) | ||||
|                 ) %> | ||||
|               </li> | ||||
|               <li> | ||||
|                 <%= link("Manage", | ||||
|                 <%= link(gettext("Manage"), | ||||
|                   class: "hover:underline", | ||||
|                   to: Routes.ammo_group_index_path(CanneryWeb.Endpoint, :index) | ||||
|                 ) %> | ||||
|               </li> | ||||
|               <%= if @current_user.role == :admin do %> | ||||
|                 <li> | ||||
|                   <%= link("Invites", | ||||
|                   <%= link(gettext("Invites"), | ||||
|                     class: "hover:underline", | ||||
|                     to: Routes.invite_index_path(CanneryWeb.Endpoint, :index) | ||||
|                   ) %> | ||||
| @@ -72,7 +72,7 @@ defmodule CanneryWeb.Component.Topbar do | ||||
|               <li> | ||||
|                 <%= link to: Routes.user_session_path(CanneryWeb.Endpoint, :delete), | ||||
|                      method: :delete, | ||||
|                      data: [confirm: "Are you sure you want to log out?"] do %> | ||||
|                      data: [confirm: dgettext("prompts", "Are you sure you want to log out?")] do %> | ||||
|                   <i class="fas fa-sign-out-alt"></i> | ||||
|                 <% end %> | ||||
|               </li> | ||||
| @@ -86,14 +86,14 @@ defmodule CanneryWeb.Component.Topbar do | ||||
|             <% else %> | ||||
|               <%= if Accounts.allow_registration?() do %> | ||||
|                 <li> | ||||
|                   <%= link("Register", | ||||
|                   <%= link(dgettext("actions", "Register"), | ||||
|                     class: "hover:underline", | ||||
|                     to: Routes.user_registration_path(CanneryWeb.Endpoint, :new) | ||||
|                   ) %> | ||||
|                 </li> | ||||
|               <% end %> | ||||
|               <li> | ||||
|                 <%= link("Log in", | ||||
|                 <%= link(dgettext("actions", "Log in"), | ||||
|                   class: "hover:underline", | ||||
|                   to: Routes.user_session_path(CanneryWeb.Endpoint, :new) | ||||
|                 ) %> | ||||
| @@ -102,16 +102,6 @@ defmodule CanneryWeb.Component.Topbar do | ||||
|           </ul> | ||||
|         </div> | ||||
|       </nav> | ||||
|       <%= if @flash && @flash |> Map.has_key?(:info) do %> | ||||
|         <p class="alert alert-info" role="alert" phx-click="lv:clear-flash" phx-value-key="info"> | ||||
|           <%= live_flash(@flash, :info) %> | ||||
|         </p> | ||||
|       <% end %> | ||||
|       <%= if @flash && @flash |> Map.has_key?(:error) do %> | ||||
|         <p class="alert alert-danger" role="alert" phx-click="lv:clear-flash" phx-value-key="error"> | ||||
|           <%= live_flash(@flash, :error) %> | ||||
|         </p> | ||||
|       <% end %> | ||||
|     </header> | ||||
|     """ | ||||
|   end | ||||
|   | ||||
| @@ -2,6 +2,7 @@ | ||||
|   <header class="mb-4 px-8 py-4 w-full bg-primary-400"> | ||||
|     <%= render("topbar.html", assigns) %> | ||||
|   </header> | ||||
|  | ||||
|   <div class="mx-8 my-2 flex flex-col space-y-4 text-center"> | ||||
|     <%= if get_flash(@conn, :info) do %> | ||||
|       <p class="alert alert-info" role="alert"> | ||||
| @@ -14,5 +15,6 @@ | ||||
|       </p> | ||||
|     <% end %> | ||||
|   </div> | ||||
|  | ||||
|   <%= @inner_content %> | ||||
| </main> | ||||
|   | ||||
| @@ -15,6 +15,7 @@ | ||||
|     > | ||||
|     </script> | ||||
|   </head> | ||||
|  | ||||
|   <body class="m-0 p-0 w-full h-full"> | ||||
|     <%= @inner_content %> | ||||
|   </body> | ||||
|   | ||||
| @@ -1,34 +1,42 @@ | ||||
| <nav role="navigation"> | ||||
|   <div class="flex flex-row justify-between items-center space-x-4 overflow-x-hidden"> | ||||
|     <%= link to: Routes.live_path(CanneryWeb.Endpoint, HomeLive) do %> | ||||
|       <h1 class="leading-5 text-xl text-white hover:underline">Cannery</h1> | ||||
|       <h1 class="leading-5 text-xl text-white hover:underline"> | ||||
|         Cannery | ||||
|       </h1> | ||||
|     <% end %> | ||||
| 
 | ||||
|     <ul class="flex flex-col sm:flex-row flex-wrap justify-center items-center | ||||
|       space-x-4 text-lg text-white text-ellipsis"> | ||||
|       <%# user settings %> | ||||
|       <%= if assigns |> Map.has_key?(:current_user) && @current_user do %> | ||||
|         <li> | ||||
|           <%= link @current_user.email, class: "hover:underline", | ||||
|             to: Routes.user_settings_path(CanneryWeb.Endpoint, :edit) %> | ||||
|           <%= link(@current_user.email, | ||||
|             class: "hover:underline", | ||||
|             to: Routes.user_settings_path(CanneryWeb.Endpoint, :edit) | ||||
|           ) %> | ||||
|         </li> | ||||
|         <li> | ||||
|           <%= link to: Routes.user_session_path(CanneryWeb.Endpoint, :delete), method: :delete, | ||||
|             data: [confirm: "Are you sure you want to log out?"] do %> | ||||
|           <%= link to: Routes.user_session_path(CanneryWeb.Endpoint, :delete), | ||||
|                method: :delete, | ||||
|                data: [confirm: dgettext("prompts", "Are you sure you want to log out?")] do %> | ||||
|             <i class="fas fa-sign-out-alt"></i> | ||||
|           <% end %> | ||||
|         </li> | ||||
|       <% else %> | ||||
|         <%= if Accounts.allow_registration?() do %> | ||||
|           <li> | ||||
|             <%= link "Register", class: "hover:underline", | ||||
|               to: Routes.user_registration_path(CanneryWeb.Endpoint, :new) %> | ||||
|             <%= link(dgettext("actions", "Register"), | ||||
|               class: "hover:underline", | ||||
|               to: Routes.user_registration_path(CanneryWeb.Endpoint, :new) | ||||
|             ) %> | ||||
|           </li> | ||||
|         <% end %> | ||||
| 
 | ||||
|         <li> | ||||
|           <%= link "Log in", class: "hover:underline", | ||||
|             to: Routes.user_session_path(CanneryWeb.Endpoint, :new) %> | ||||
|           <%= link(dgettext("actions", "Log in"), | ||||
|             class: "hover:underline", | ||||
|             to: Routes.user_session_path(CanneryWeb.Endpoint, :new) | ||||
|           ) %> | ||||
|         </li> | ||||
|       <% end %> | ||||
|     </ul> | ||||
							
								
								
									
										23
									
								
								priv/gettext/actions.pot
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								priv/gettext/actions.pot
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| ## 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/component/topbar.ex:96 | ||||
| #: lib/cannery_web/templates/layout/topbar.html.heex:36 | ||||
| msgid "Log in" | ||||
| msgstr "" | ||||
|  | ||||
| #, elixir-format, ex-autogen | ||||
| #: lib/cannery_web/component/topbar.ex:89 | ||||
| #: lib/cannery_web/templates/layout/topbar.html.heex:28 | ||||
| msgid "Register" | ||||
| msgstr "" | ||||
| @@ -74,3 +74,28 @@ msgstr "" | ||||
| #: lib/cannery_web/live/home_live.ex:66 | ||||
| msgid "Self-host your own instance, or use an instance from someone you trust." | ||||
| msgstr "" | ||||
|  | ||||
| #, elixir-format, ex-autogen | ||||
| #: lib/cannery_web/component/topbar.ex:47 | ||||
| msgid "Ammo" | ||||
| msgstr "" | ||||
|  | ||||
| #, elixir-format, ex-autogen | ||||
| #: lib/cannery_web/component/topbar.ex:41 | ||||
| msgid "Containers" | ||||
| msgstr "" | ||||
|  | ||||
| #, elixir-format, ex-autogen | ||||
| #: lib/cannery_web/component/topbar.ex:60 | ||||
| msgid "Invites" | ||||
| msgstr "" | ||||
|  | ||||
| #, elixir-format, ex-autogen | ||||
| #: lib/cannery_web/component/topbar.ex:53 | ||||
| msgid "Manage" | ||||
| msgstr "" | ||||
|  | ||||
| #, elixir-format, ex-autogen | ||||
| #: lib/cannery_web/component/topbar.ex:35 | ||||
| msgid "Tags" | ||||
| msgstr "" | ||||
|   | ||||
| @@ -14,3 +14,9 @@ msgstr "" | ||||
| #: lib/cannery_web/live/home_live.ex:94 | ||||
| msgid "Register to setup %{name}" | ||||
| msgstr "" | ||||
|  | ||||
| #, elixir-format, ex-autogen | ||||
| #: lib/cannery_web/component/topbar.ex:75 | ||||
| #: lib/cannery_web/templates/layout/topbar.html.heex:21 | ||||
| msgid "Are you sure you want to log out?" | ||||
| msgstr "" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user