[Bug]: Fixed localisation for subpath (#4057)

* Fixed localisation for subpath

* Fixed notification typo on localisation
This commit is contained in:
Kavin Venkatachalam 2022-09-21 10:53:30 +05:30 committed by GitHub
parent 9860cf639e
commit 3ae99adc57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 26 deletions

View file

@ -91,7 +91,7 @@ export const NotificationCenter = () => {
</p>
<p className="empty-subtitle text-muted">
{`${t('header.notificationCenter.youDontHaveany', `You don't have any`)} ${
!isRead && t('header.notificationCenter.un', 'un')
!isRead ? t('header.notificationCenter.un', 'un') : ''
}${t('header.notificationCenter.read', 'read')} ${t(
`header.notificationCenter.notifications`,
'notifications'
@ -108,10 +108,12 @@ export const NotificationCenter = () => {
</div>
<div className="card-footer text-center margin-auto">
<a href="#" className="text-muted text-decoration-none" onClick={() => setIsRead(!isRead)}>
{`${t('header.notificationCenter.view', 'View')} ${isRead && t('header.notificationCenter.un', 'un')}${t(
'header.notificationCenter.read',
'read'
)} ${t(`header.notificationCenter.notifications`, 'notifications').toLowerCase()}`}
{`${t('header.notificationCenter.view', 'View')} ${
isRead ? t('header.notificationCenter.un', 'un') : ''
}${t('header.notificationCenter.read', 'read')} ${t(
`header.notificationCenter.notifications`,
'notifications'
).toLowerCase()}`}
</a>
</div>
</div>

View file

@ -1,20 +0,0 @@
// eslint-disable-next-line import/no-unresolved
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import Backend from 'i18next-http-backend';
i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
load: 'languageOnly',
fallbackLng: 'en',
backend: {
loadPath: `/assets/translations/{{lng}}.json`,
},
});
export default i18n;

View file

@ -5,7 +5,11 @@ import { Integrations } from '@sentry/tracing';
import { createBrowserHistory } from 'history';
import { appService } from '@/_services';
import { App } from './App';
import './i18n';
// eslint-disable-next-line import/no-unresolved
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import Backend from 'i18next-http-backend';
const AppWithProfiler = Sentry.withProfiler(App);
@ -14,6 +18,19 @@ appService
.then((config) => {
window.public_config = config;
const path = config?.SUB_PATH || '/';
i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
load: 'languageOnly',
fallbackLng: 'en',
backend: {
loadPath: `${path}assets/translations/{{lng}}.json`,
},
});
if (window.public_config.APM_VENDOR === 'sentry') {
const history = createBrowserHistory();
const tooljetServerUrl = window.public_config.TOOLJET_SERVER_URL;