-
Notifications
You must be signed in to change notification settings - Fork 103
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 #33 from LuisValgoi/issue-16
[ISSUE-16] Refactor i18n
- Loading branch information
1 parent
6b04344
commit 48587f1
Showing
15 changed files
with
194 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<meta name="theme-color" content="#000000"/> | ||
<meta | ||
name="description" | ||
content="Web site created using create-react-app" | ||
/> | ||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png"/> | ||
<!-- | ||
manifest.json provides metadata used when your web app is installed on a | ||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"/> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>React App</title> | ||
|
||
<script data-ui5-config type="application/json"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=Edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<meta name="description" content="TodoList App" /> | ||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
<title>TodoList App</title> | ||
<script data-ui5-config type="application/json"> | ||
{ | ||
"compactSize": false | ||
"theme": "sap_fiori_3", | ||
"compactSize": false | ||
"language": "EN", | ||
"rtl": false | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
|
||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
</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 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
12 changes: 12 additions & 0 deletions
12
packages/ui5-webcomponents-react-seed/src/locales/en/translation.json
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 @@ | ||
{ | ||
"helmet.title.app": "TodoList App", | ||
"helmet.title.error": "Buggy Component - TodoList App", | ||
"helmet.title.notfound": "NotFound - TodoList App", | ||
"shell.title": "TodoList Application", | ||
"shell.logo.alt": "SAP Logo", | ||
"page.error.text": "Ops! There was an error in loading this page", | ||
"page.error.alt": "Error", | ||
"page.notfound.text": "Hmmm, we could find this URL", | ||
"page.notfound.alt": "Not Found", | ||
"page.fallback.reload.text": "Reload this page" | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/ui5-webcomponents-react-seed/src/locales/pt/translation.json
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 @@ | ||
{ | ||
"helmet.title.app": "TodoList Applicação", | ||
"helmet.title.error": "Component Bugado - TodoList App", | ||
"helmet.title.notfound": "Não Encontrado - TodoList App", | ||
"shell.title": "TodoList Applicação", | ||
"shell.logo.alt": "SAP Logotipo", | ||
"page.error.text": "Ops! Houve um erro durante o carregamento desta página", | ||
"page.error.alt": "Erro", | ||
"page.notfound.text": "Hmmm, não conseguimos encontrar esta página", | ||
"page.notfound.alt": "Não Encontrado", | ||
"page.fallback.reload.text": "Recarregar" | ||
} |
12 changes: 10 additions & 2 deletions
12
packages/ui5-webcomponents-react-seed/src/pages/Fallback/Error.js
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
11 changes: 9 additions & 2 deletions
11
packages/ui5-webcomponents-react-seed/src/pages/Fallback/NotFound.js
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,31 @@ | ||
import i18n from 'i18next'; | ||
import { initReactI18next } from 'react-i18next'; | ||
|
||
import LanguageDetector from 'i18next-browser-languagedetector'; | ||
|
||
import translationEN from '../locales/en/translation.json'; | ||
import translationPT from '../locales/pt/translation.json'; | ||
|
||
i18n | ||
.use(LanguageDetector) | ||
.use(initReactI18next) | ||
.init({ | ||
debug: true, | ||
keySeparator: false, | ||
interpolation: { | ||
escapeValue: false | ||
}, | ||
resources: { | ||
en: { | ||
translation: translationEN | ||
}, | ||
pt: { | ||
translation: translationPT | ||
} | ||
}, | ||
react: { | ||
useSuspense: false | ||
} | ||
}); | ||
|
||
export default i18n; |
Oops, something went wrong.