forked from pupilfirst/pupilfirst
-
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.
Revert "Switch to v4 alpha of i18n-js (pupilfirst#759)" (pupilfirst#772)
This reverts commit f9bd846.
- Loading branch information
Showing
23 changed files
with
173 additions
and
204 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
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
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,8 +1,10 @@ | ||
import { I18n } from "i18n-js"; | ||
import translations from "locales.json"; | ||
import I18n from "i18n-js"; | ||
|
||
export const i18n = new I18n(translations); | ||
i18n.locale = document.documentElement.lang || "en"; | ||
i18n.missingTranslationPrefix = "Missing translation: "; | ||
I18n.originalMissingTranslation = I18n.missingTranslation; | ||
|
||
global.i18n = i18n; | ||
I18n.missingTranslation = (scope, options) => { | ||
console.error("Missing translation " + scope) | ||
return I18n.originalMissingTranslation(scope, options); | ||
}; | ||
|
||
global.I18n = I18n; |
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 |
---|---|---|
@@ -1,76 +1,65 @@ | ||
<% presenter = ::Layouts::TailwindPresenter.new(self) %> | ||
|
||
<!DOCTYPE html> | ||
<html | ||
lang="<%= I18n.locale %>" | ||
data-user-id="<%= current_user&.id %>" | ||
data-flash="<%= presenter.flash_messages %>" | ||
data-env="<%= Rails.env %>" | ||
data-vapid-public-key="<%= presenter.vapid_public_key_bytes %>" | ||
data-subscription-endpoint="<%= presenter.webpush_subscription_endpoint %>" | ||
> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<link rel="manifest" href="/manifest.json" /> | ||
<html lang='en' data-user-id="<%= current_user&.id %>" data-flash="<%= presenter.flash_messages %>" data-env="<%= Rails.env %>" data-vapid-public-key="<%= presenter.vapid_public_key_bytes %>" data-subscription-endpoint="<%= presenter.webpush_subscription_endpoint %>"> | ||
|
||
<% if content_for?(:viewport) %> | ||
<%= yield :viewport %> | ||
<% else %> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<% end %> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> | ||
<link rel="manifest" href="/manifest.json"> | ||
|
||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags. --> | ||
<meta name="theme-color" content="#4D1E9A" /> | ||
<%= yield :head %> | ||
<% if content_for?(:viewport) %> | ||
<%= yield :viewport %> | ||
<% else %> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<% end %> | ||
|
||
<!-- Styles --> | ||
<link | ||
href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
href="https://fonts.googleapis.com/icon?family=Material+Icons" | ||
rel="stylesheet" | ||
/> | ||
<%= stylesheet_pack_tag 'layouts/tailwind', media: 'all', 'data-turbolinks-track': 'reload' %> | ||
<%= stylesheet_pack_tag 'IconFirstPack', media: 'all' %> | ||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags. --> | ||
<meta name="theme-color" content="#4D1E9A"> | ||
<%= yield :head %> | ||
|
||
<!-- Scripts --> | ||
<%= javascript_pack_tag 'layouts/tailwind', nonce: true %> | ||
<!-- Styles --> | ||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | ||
<%= stylesheet_pack_tag 'layouts/tailwind', media: 'all', 'data-turbolinks-track': 'reload' %> | ||
<%= stylesheet_pack_tag 'IconFirstPack', media: 'all' %> | ||
|
||
<%= javascript_tag(nonce: true) do %> | ||
i18n.defaultLocale = "<%= I18n.default_locale %>"; i18n.locale = "<%= I18n.locale %>"; | ||
<% end %> | ||
<!-- Scripts --> | ||
<%= javascript_pack_tag 'layouts/tailwind', nonce: true %> | ||
|
||
<%= csrf_meta_tags %> | ||
<%= javascript_tag(nonce: true) do %> | ||
I18n.defaultLocale = "<%= I18n.default_locale %>"; | ||
I18n.locale = "<%= I18n.locale %>"; | ||
<% end %> | ||
|
||
<% if presenter.meta_description.present? %> | ||
<meta name="description" content="<%= presenter.meta_description %>" /> | ||
<meta | ||
property="og:description" | ||
content="<%= presenter.meta_description %>" | ||
/> | ||
<% end %> | ||
<%= javascript_pack_tag "translations/#{I18n.locale}", nonce: true %> | ||
|
||
<%= csrf_meta_tags %> | ||
|
||
<link rel="icon" href="/favicon.ico" /> | ||
</head> | ||
<% if presenter.meta_description.present? %> | ||
<meta name="description" content="<%= presenter.meta_description %>"/> | ||
<meta property="og:description" content="<%= presenter.meta_description %>"/> | ||
<% end %> | ||
|
||
<link rel="icon" href="/favicon.ico"/> | ||
</head> | ||
|
||
<body data-host="<%= current_host %>"> | ||
<section class="min-h-full flex flex-col items-stretch"> | ||
<%= yield :nav %> | ||
<main class="flex-grow bg-gray-100"> | ||
<% if content_for?(:wrapper) %> | ||
<%= yield :wrapper %> | ||
<% else %> | ||
<%= yield %> | ||
<% end %> | ||
</main> | ||
|
||
<body data-host="<%= current_host %>"> | ||
<section class="min-h-full flex flex-col items-stretch"> | ||
<%= yield :nav %> | ||
<main class="flex-grow bg-gray-100"> | ||
<% if content_for?(:wrapper) %> | ||
<%= yield :wrapper %> | ||
<% else %> | ||
<%= yield %> | ||
<% end %> | ||
</main> | ||
<%= yield :tail %> | ||
<%= yield :footer %> | ||
</section> | ||
<!-- Scripts --> | ||
<%= javascript_pack_tag 'IconFirstPack', nonce: true %> | ||
</body> | ||
|
||
<%= yield :tail %> | ||
<%= yield :footer %> | ||
</section> | ||
<!-- Scripts --> | ||
<%= javascript_pack_tag 'IconFirstPack', nonce: true %> | ||
</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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.