Add Docker build and deploy pipeline
Some checks failed
deploy-frontend / deploy (push) Failing after 11s

This commit is contained in:
SlimusMinus
2026-10-07 23:27:38 +03:00
parent 6791ee6eb3
commit 6dc61050d9
23 changed files with 722 additions and 41 deletions

34
src/i18n.js Normal file
View File

@@ -0,0 +1,34 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import translationRU from './locales/ru.json';
import translationEN from './locales/en.json';
const LANGUAGES = ['ru', 'en'];
// i18next-browser-languagedetector в проекте нет, поэтому persist делаем сами:
// иначе выбор языка жил только в памяти и сбрасывался при перезагрузке.
const stored = localStorage.getItem('i18nextLng');
const savedLang = LANGUAGES.includes(stored) ? stored : 'ru';
i18n.use(initReactI18next).init({
resources: {
ru: { translation: translationRU },
en: { translation: translationEN },
},
lng: savedLang,
fallbackLng: 'ru',
supportedLngs: LANGUAGES,
interpolation: { escapeValue: false },
});
const updateDocumentTitle = (lng) => {
document.title = lng === 'en' ? 'Find' : 'Находка';
};
i18n.on('languageChanged', (lng) => {
localStorage.setItem('i18nextLng', lng);
updateDocumentTitle(lng);
});
updateDocumentTitle(i18n.language);
export default i18n;