mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-21 18:55:19 -04:00
Update dependency i18next to v21.5.2 (#1643)
* Update dependency i18next to v21.5.2 Signed-off-by: Renovate Bot <bot@renovateapp.com> * Fix i18n imports Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
29e646e180
commit
c75978c9a4
5 changed files with 11 additions and 12 deletions
|
@ -141,7 +141,7 @@
|
||||||
"fork-awesome": "1.2.0",
|
"fork-awesome": "1.2.0",
|
||||||
"highlight.js": "11.3.1",
|
"highlight.js": "11.3.1",
|
||||||
"http-server": "14.0.0",
|
"http-server": "14.0.0",
|
||||||
"i18next": "21.4.2",
|
"i18next": "21.5.2",
|
||||||
"i18next-browser-languagedetector": "6.1.2",
|
"i18next-browser-languagedetector": "6.1.2",
|
||||||
"i18next-resources-to-backend": "1.0.0",
|
"i18next-resources-to-backend": "1.0.0",
|
||||||
"js-yaml": "4.1.0",
|
"js-yaml": "4.1.0",
|
||||||
|
|
|
@ -5,15 +5,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { ResourceKey } from 'i18next'
|
import type { ResourceKey } from 'i18next'
|
||||||
import i18n from 'i18next'
|
import i18n, { use as i18nUse } from 'i18next'
|
||||||
import LanguageDetector from 'i18next-browser-languagedetector'
|
import LanguageDetector from 'i18next-browser-languagedetector'
|
||||||
import resourcesToBackend from 'i18next-resources-to-backend'
|
import resourcesToBackend from 'i18next-resources-to-backend'
|
||||||
import { Settings } from 'luxon'
|
import { Settings } from 'luxon'
|
||||||
import { initReactI18next } from 'react-i18next'
|
import { initReactI18next } from 'react-i18next'
|
||||||
|
|
||||||
export const setUpI18n = async (): Promise<void> => {
|
export const setUpI18n = async (): Promise<void> => {
|
||||||
await i18n
|
await i18nUse(
|
||||||
.use(
|
|
||||||
resourcesToBackend((language, namespace, callback) => {
|
resourcesToBackend((language, namespace, callback) => {
|
||||||
import(`../../../../../locales/${language}.json`)
|
import(`../../../../../locales/${language}.json`)
|
||||||
.then((resources: ResourceKey) => {
|
.then((resources: ResourceKey) => {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Editor } from 'codemirror'
|
import type { Editor } from 'codemirror'
|
||||||
import i18n from 'i18next'
|
import { t } from 'i18next'
|
||||||
import { uploadFile } from '../../../api/media'
|
import { uploadFile } from '../../../api/media'
|
||||||
import { store } from '../../../redux'
|
import { store } from '../../../redux'
|
||||||
import { supportedMimeTypes } from '../../common/upload-image-mimetypes'
|
import { supportedMimeTypes } from '../../common/upload-image-mimetypes'
|
||||||
|
@ -22,7 +22,7 @@ export const handleUpload = (file: File, editor: Editor): void => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const cursor = editor.getCursor()
|
const cursor = editor.getCursor()
|
||||||
const uploadPlaceholder = `![${i18n.t('editor.upload.uploadFile', { fileName: file.name })}]()`
|
const uploadPlaceholder = `![${t('editor.upload.uploadFile', { fileName: file.name })}]()`
|
||||||
const noteId = store.getState().noteDetails.id
|
const noteId = store.getState().noteDetails.id
|
||||||
const insertCode = (replacement: string) => {
|
const insertCode = (replacement: string) => {
|
||||||
editor.replaceRange(replacement, cursor, { line: cursor.line, ch: cursor.ch + uploadPlaceholder.length }, '+input')
|
editor.replaceRange(replacement, cursor, { line: cursor.line, ch: cursor.ch + uploadPlaceholder.length }, '+input')
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { TOptions } from 'i18next'
|
import type { TOptions } from 'i18next'
|
||||||
import i18n from 'i18next'
|
import { t } from 'i18next'
|
||||||
import { store } from '../index'
|
import { store } from '../index'
|
||||||
import type { DismissUiNotificationAction, DispatchOptions } from './types'
|
import type { DismissUiNotificationAction, DispatchOptions } from './types'
|
||||||
import { UiNotificationActionType } from './types'
|
import { UiNotificationActionType } from './types'
|
||||||
|
@ -75,7 +75,7 @@ export const dismissUiNotification = (notificationId: number): void => {
|
||||||
export const showErrorNotification =
|
export const showErrorNotification =
|
||||||
(messageI18nKey: string, messageI18nOptions?: TOptions | string) =>
|
(messageI18nKey: string, messageI18nOptions?: TOptions | string) =>
|
||||||
(error: Error): void => {
|
(error: Error): void => {
|
||||||
log.error(i18n.t(messageI18nKey, messageI18nOptions), error)
|
log.error(t(messageI18nKey, messageI18nOptions), error)
|
||||||
void dispatchUiNotification('common.errorOccurred', messageI18nKey, {
|
void dispatchUiNotification('common.errorOccurred', messageI18nKey, {
|
||||||
contentI18nOptions: messageI18nOptions,
|
contentI18nOptions: messageI18nOptions,
|
||||||
icon: 'exclamation-triangle'
|
icon: 'exclamation-triangle'
|
||||||
|
|
|
@ -8056,10 +8056,10 @@ i18next-resources-to-backend@1.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "7.14.0"
|
"@babel/runtime" "7.14.0"
|
||||||
|
|
||||||
i18next@21.4.2:
|
i18next@21.5.2:
|
||||||
version "21.4.2"
|
version "21.5.2"
|
||||||
resolved "https://registry.yarnpkg.com/i18next/-/i18next-21.4.2.tgz#10d10e07c9d1d589d71ac031f8ae755a37fcd0fc"
|
resolved "https://registry.yarnpkg.com/i18next/-/i18next-21.5.2.tgz#ababe6fb0a769360035ebf06a36751e0b810cdfa"
|
||||||
integrity sha512-vVWsmTnZNdYHPLt01MvT5YNM2lxec2R6r5T72J89eaazp8XQnGSqA66O+a918qqmjHZGB6HHRSs02xp753he9g==
|
integrity sha512-Iuztr2+7CPCh5SYQV0utw2HXMx1za18xfznrw/PmgX+98oIpm84bhIM7VUPODjLycwIZ299oP7sEVQ9oCgmzfg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.12.0"
|
"@babel/runtime" "^7.12.0"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue