-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gen3: Use i18next instead of loc
#3689
Open
denysoblohin-okta
wants to merge
34
commits into
master
Choose a base branch
from
od-test-i18next
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+332
−62
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
51d69a0
poc use i18next
denysoblohin-okta 564a821
lint fix
denysoblohin-okta 4a07d89
set lang
denysoblohin-okta fc43412
don't conflict with odyssey
denysoblohin-okta 74f3664
lint fix, no escape
denysoblohin-okta b03b8c7
lint fix
denysoblohin-okta 56e7bec
fix fallback
denysoblohin-okta ff70cc8
fix transl
denysoblohin-okta ae2fb11
fix undefined bundle; emit lion error
denysoblohin-okta 5f880af
lint fix
denysoblohin-okta 2036015
jest mock fix
denysoblohin-okta 628337d
lint fix
denysoblohin-okta d9acbfd
fix jest?
denysoblohin-okta df454f1
logic fix
denysoblohin-okta 03259a5
fix for default language
denysoblohin-okta ee7ceb4
fix lint, plural
denysoblohin-okta 2f2ea39
use own i18next instance
denysoblohin-okta dedc21f
Override global `loc` util
denysoblohin-okta 1d1a12d
ini i18next instance automatically
denysoblohin-okta 603f8ba
don't remove resources @ dev
denysoblohin-okta 02ed5a4
fix tests
denysoblohin-okta 913dfc0
fix test locUtil
denysoblohin-okta 092db8b
.
denysoblohin-okta bcb74d6
fix test
denysoblohin-okta 530dfbe
nit
denysoblohin-okta 7d18b19
lint fix
denysoblohin-okta f662523
upd sizes
denysoblohin-okta 62404a8
remove plural forms
denysoblohin-okta a73b129
remove getLocUtil
denysoblohin-okta bb4163a
move initDefaultLanguage into effect
denysoblohin-okta 4153b35
move initDefaultLanguage to useOnce
denysoblohin-okta 5e35244
nit
denysoblohin-okta c26d3b3
added tests
denysoblohin-okta 118d13c
add test, lint fix
denysoblohin-okta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved. | ||
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") | ||
* | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* | ||
* See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
import i18next from 'i18next'; | ||
|
||
import config from '../../../config/config.json'; | ||
|
||
const i18ni = i18next.createInstance(); | ||
|
||
const ns = ['login', 'country']; | ||
const defaultNS = 'login'; | ||
|
||
i18ni.init({ | ||
defaultNS, | ||
ns, | ||
fallbackLng: config.defaultLanguage, | ||
load: 'currentOnly', | ||
keySeparator: false, | ||
nsSeparator: ':', | ||
interpolation: { | ||
prefix: '{', | ||
suffix: '}', | ||
// No need to escape | ||
// Need to use raw value for phone numbers containing `‎` | ||
// React is already safe from XSS | ||
escapeValue: false, | ||
skipOnVariables: false, // to handle translations that use nesting | ||
}, | ||
}); | ||
|
||
export { i18ni as i18next }; |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a necessary change, just small optimisation.
Noticed that for pages that don't have auth coin there will be a lot of unnecessary
loc
calls insidegetAuthCoinConfiguration()