-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jan
authored
Apr 12, 2023
1 parent
05cc0db
commit a64286c
Showing
6 changed files
with
66 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Enhancement: Custom translations | ||
|
||
We have added the possibility to include own translations to override existing translations. | ||
To inject custom translations add the following property to your `config.json`, `"customTranslation": [{ "url": "https://localhost:9200/translations.json" }]`. | ||
|
||
https://github.com/owncloud/web/pull/8790 | ||
https://github.com/owncloud/web/issues/8791 |
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,29 @@ | ||
import { ConfigurationManager } from 'web-pkg' | ||
import { v4 as uuidV4 } from 'uuid' | ||
import merge from 'lodash-es/merge' | ||
|
||
export const loadCustomTranslations = async ({ | ||
configurationManager | ||
}: { | ||
configurationManager: ConfigurationManager | ||
}): Promise<unknown> => { | ||
const customTranslations = {} | ||
for (const customTranslation of configurationManager.customTranslations) { | ||
const customTranslationResponse = await fetch(customTranslation.url, { | ||
headers: { 'X-Request-ID': uuidV4() } | ||
}) | ||
if (customTranslationResponse.status !== 200) { | ||
console.error( | ||
`translation file ${customTranslation} could not be loaded. HTTP status-code ${customTranslationResponse.status}` | ||
) | ||
continue | ||
} | ||
try { | ||
const customTranslationJSON = await customTranslationResponse.json() | ||
merge(customTranslations, customTranslationJSON) | ||
} catch (e) { | ||
console.error(`translation file ${customTranslation} could not be parsed. ${e}`) | ||
} | ||
} | ||
return customTranslations | ||
} |
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