This repository was archived by the owner on Jun 24, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 153
i18n: First steps #248
Merged
Merged
i18n: First steps #248
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
33d6d51
i18n: Set up i18next
eliandoran 10ec7d6
i18n: Set up client dependency to i18next
eliandoran 0dbe670
i18n: Translate about page
eliandoran 7848914
i18n: Add Romanian as demo
eliandoran d14cf7c
i18n: Move translations to backend serve
eliandoran d4bf162
i18n: Add i18next-http-backend to library loader
eliandoran 5ea35dd
i18n: Implement HTTP backend loader
eliandoran 288e677
i18n: Change back to English
eliandoran e284ea9
i18n: Improve formatting
eliandoran 906dad6
dev: Set up i18n-ally
eliandoran de342c3
dev: Set up key style & source language
eliandoran 2fb05ab
Merge remote-tracking branch 'origin/develop' into feature/i18n_first…
eliandoran ece343a
dev: Improve custom translation framework slightly
eliandoran 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 hidden or 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,5 @@ | ||
| { | ||
| "recommendations": [ | ||
| "lokalise.i18n-ally" | ||
| ] | ||
| } |
This file contains hidden or 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,30 @@ | ||
| # An array of strings which contain Language Ids defined by VS Code | ||
| # You can check available language ids here: https://code.visualstudio.com/docs/languages/identifiers | ||
| languageIds: | ||
| - javascript | ||
| - typescript | ||
|
|
||
| # An array of RegExes to find the key usage. **The key should be captured in the first match group**. | ||
| # You should unescape RegEx strings in order to fit in the YAML file | ||
| # To help with this, you can use https://www.freeformatter.com/json-escape.html | ||
| usageMatchRegex: | ||
| # The following example shows how to detect `t("your.i18n.keys")` | ||
| # the `{key}` will be placed by a proper keypath matching regex, | ||
| # you can ignore it and use your own matching rules as well | ||
| - "[^\\w\\d]t\\(['\"`]({key})['\"`]" | ||
|
|
||
| # A RegEx to set a custom scope range. This scope will be used as a prefix when detecting keys | ||
| # and works like how the i18next framework identifies the namespace scope from the | ||
| # useTranslation() hook. | ||
| # You should unescape RegEx strings in order to fit in the YAML file | ||
| # To help with this, you can use https://www.freeformatter.com/json-escape.html | ||
| scopeRangeRegex: "useTranslation\\(\\s*\\[?\\s*['\"`](.*?)['\"`]" | ||
|
|
||
| # An array of strings containing refactor templates. | ||
| # The "$1" will be replaced by the keypath specified. | ||
| refactorTemplates: | ||
| - t("$1") | ||
|
|
||
|
|
||
| # If set to true, only enables this custom framework (will disable all built-in frameworks) | ||
| monopoly: true |
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,15 @@ | ||
| import library_loader from "./library_loader.js"; | ||
|
|
||
| await library_loader.requireLibrary(library_loader.I18NEXT); | ||
|
|
||
| await i18next | ||
| .use(i18nextHttpBackend) | ||
| .init({ | ||
| lng: "en", | ||
| debug: true, | ||
| backend: { | ||
| loadPath: `/${window.glob.assetPath}/translations/{{lng}}/{{ns}}.json` | ||
| } | ||
| }); | ||
|
|
||
| export const t = i18next.t; |
This file contains hidden or 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 hidden or 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 hidden or 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 @@ | ||
| { | ||
| "about": { | ||
| "title": "About TriliumNext Notes", | ||
| "homepage": "Homepage:", | ||
| "app_version": "App version:", | ||
| "db_version": "DB version:", | ||
| "sync_version": "Sync version:", | ||
| "build_date": "Build date:", | ||
| "build_revision": "Build revision:", | ||
| "data_directory": "Data directory:" | ||
| } | ||
| } |
This file contains hidden or 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 @@ | ||
| { | ||
| "about": { | ||
| "title": "Despre TriliumNext Notes", | ||
| "homepage": "Site web:", | ||
| "app_version": "Versiune aplicație:", | ||
| "db_version": "Versiune bază de date:", | ||
| "sync_version": "Versiune sincronizare:", | ||
| "build_date": "Data compilării:", | ||
| "build_revision": "Revizia compilării:", | ||
| "data_directory": "Directorul de date:" | ||
| } | ||
| } |
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.