-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for dynamic context (#180)
* Add support for dynamic context * Refactor default context values. * refactor: use immediately invoked function expression (IIFE) to improve code readibility Co-authored-by: Cheton Wu <[email protected]>
- Loading branch information
Showing
5 changed files
with
56 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
i18next.t('friend', {context: 'male'}); // output: 'A boyfriend' | ||
i18next.t('friend', {context: 'female'}); // output: 'A girlfriend' | ||
i18next.t('friendDynamic', {context: dynamicVal}); |
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
ac78ff9
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.
Hello Team,
when i try to use context for dynamic values it does not give me expected result.I dont know if i am using the right syntax.
i am using i18n.t("friend",{context:
${gender}
}) where i have created state for gender const [gender,setGender]=useState("male").Can anyone help ?