mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 10:15:17 -04:00
refactor: move mockI18n
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
3962cafa5d
commit
86276b0753
35 changed files with 36 additions and 36 deletions
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { mockI18n } from '../../test-utils/mock-i18n'
|
||||
import { mockI18n } from '../../../../test-utils/mock-i18n'
|
||||
import { TestMarkdownRenderer } from '../../test-utils/test-markdown-renderer'
|
||||
import { EmojiMarkdownExtension } from './emoji-markdown-extension'
|
||||
import { render } from '@testing-library/react'
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { mockI18n } from '../../test-utils/mock-i18n'
|
||||
import { mockI18n } from '../../../../test-utils/mock-i18n'
|
||||
import { TestMarkdownRenderer } from '../../test-utils/test-markdown-renderer'
|
||||
import { LinkifyFixMarkdownExtension } from './linkify-fix-markdown-extension'
|
||||
import { render } from '@testing-library/react'
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import type { TFunction } from 'i18next'
|
||||
import i18n from 'i18next'
|
||||
import { initReactI18next } from 'react-i18next'
|
||||
|
||||
/**
|
||||
* Initializes i18n with minimal settings and without any data, so it just returns the used key as translation.
|
||||
*
|
||||
* @return A promise that resolves if i18n has been initialized
|
||||
*/
|
||||
export const mockI18n = (): Promise<TFunction> => {
|
||||
return i18n.use(initReactI18next).init({
|
||||
lng: 'en',
|
||||
fallbackLng: 'en',
|
||||
ns: ['translationsNS'],
|
||||
defaultNS: 'translationsNS',
|
||||
interpolation: {
|
||||
escapeValue: false
|
||||
},
|
||||
resources: { en: { translationsNS: {} } }
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue