-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from renuo/better_dummy_app
Adds translations to the dummy app
- Loading branch information
Showing
10 changed files
with
89 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<p> | ||
<%= t('first_paragraph') %> | ||
</p> | ||
|
||
<button><%= t('buttons.very.much.nested.value') %></button> | ||
|
||
<p><%= t('second_paragraph') %></p> | ||
|
||
<button><%= t('buttons.very.much.nested.only_german') %></button> | ||
<button><%= t('buttons.very.much.nested.only_english') %></button> | ||
<button><%= t('buttons.very.much.nested.only_italian') %></button> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
class ApplicationController < ActionController::Base | ||
around_action :switch_locale | ||
|
||
def switch_locale(&action) | ||
locale = params[:locale] || I18n.default_locale | ||
I18n.with_locale(locale, &action) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
class HomeController < ApplicationController | ||
layout "layouts/application" | ||
|
||
def index | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Dummy</title> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<%= csrf_meta_tags %> | ||
<%= csp_meta_tag %> | ||
<head> | ||
<title>Dummy</title> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<%= csrf_meta_tags %> | ||
<%= csp_meta_tag %> | ||
|
||
<%= stylesheet_link_tag "application" %> | ||
</head> | ||
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css"> | ||
</head> | ||
|
||
<body> | ||
<%= yield %> | ||
</body> | ||
|
||
<body> | ||
<header> | ||
<nav> | ||
<%=link_to t('locales.german'), root_path(locale: :de) %> | ||
<%=link_to t('locales.english'), root_path(locale: :en) %> | ||
<%=link_to t('locales.italian'), root_path(locale: :it) %> | ||
</nav> | ||
</header> | ||
<main> | ||
<%= yield %> | ||
</main> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
de: | ||
locales: | ||
german: Deutsch | ||
italian: Italienisch | ||
english: Englisch | ||
first_paragraph: Dies ist eine Dummy-App von moirai zum Testen. Wechseln Sie die Sprache über die Navigationsleiste. | ||
second_paragraph: Fallback-Sprache ist Englisch. Die folgenden Schaltflächen wurden nur in einer Sprache definiert | ||
buttons: | ||
very: | ||
much: | ||
nested: | ||
value: Klick mich | ||
only_german: Nur Deutsch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,13 @@ | ||
# Files in the config/locales directory are used for internationalization | ||
# and are automatically loaded by Rails. If you want to use locales other | ||
# than English, add the necessary files in this directory. | ||
# | ||
# To use the locales, use `I18n.t`: | ||
# | ||
# I18n.t "hello" | ||
# | ||
# In views, this is aliased to just `t`: | ||
# | ||
# <%= t("hello") %> | ||
# | ||
# To use a different locale, set it with `I18n.locale`: | ||
# | ||
# I18n.locale = :es | ||
# | ||
# This would use the information in config/locales/es.yml. | ||
# | ||
# The following keys must be escaped otherwise they will not be retrieved by | ||
# the default I18n backend: | ||
# | ||
# true, false, on, off, yes, no | ||
# | ||
# Instead, surround them with single quotes. | ||
# | ||
# en: | ||
# "true": "foo" | ||
# | ||
# To learn more, please read the Rails Internationalization guide | ||
# available at https://guides.rubyonrails.org/i18n.html. | ||
|
||
en: | ||
hello: "Hello world" | ||
locales: | ||
german: German | ||
italian: Italian | ||
english: English | ||
first_paragraph: This is moirai dummy app for testing. Switch language from the navbar. | ||
second_paragraph: Fallback language is English. The following buttons have been defined only in one language | ||
buttons: | ||
very: | ||
much: | ||
nested: | ||
value: Click me | ||
only_english: Only English |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
it: | ||
locales: | ||
german: Tedesco | ||
italian: Italiano | ||
english: Inglese | ||
first_paragraph: Questa è l'applicazione moirai dummy per i test. Cambi la lingua dalla barra di navigazione. | ||
second_paragraph: La lingua di riserva è l'inglese. I seguenti pulsanti sono stati definiti solo in una lingua | ||
buttons: | ||
very: | ||
much: | ||
nested: | ||
value: Cliccami | ||
only_italian: Solo italiano |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,6 @@ | |
|
||
Rails.application.routes.draw do | ||
mount Moirai::Engine => "/moirai" | ||
|
||
root to: "home#index" | ||
end |