Web:Common:Utils: change loadLanguagePath

This commit is contained in:
Timofey Boyko 2023-01-30 19:19:35 +03:00
parent 5dcfac2dc8
commit 2a46b713d9

View File

@ -22,6 +22,7 @@ import TopLoaderService from "@docspace/components/top-loading-indicator";
import { Encoder } from "./encoder";
import FilesFilter from "../api/files/filter";
import combineUrlFunc from "./combineUrl";
import { translations } from "./i18next-http-backend/lib/translations";
export const toUrlParams = (obj, skipNull) => {
let str = "";
for (var key in obj) {
@ -295,10 +296,17 @@ export function loadLanguagePath(homepage, fixedNS = null) {
return (lng, ns) => {
const language = getLanguage(lng instanceof Array ? lng[0] : lng);
const lngCollection = translations.get(language);
if (ns.length > 0 && ns[0] === "Common") {
return `/static/locales/${language}/Common.json`;
return lngCollection?.get("Common");
}
return `${homepage}/locales/${language}/${fixedNS || ns}.json`;
return lngCollection?.get(`${fixedNS || ns}`);
// if (ns.length > 0 && ns[0] === "Common") {
// return `/static/locales/${language}/Common.json`;
// }
// return `${homepage}/locales/${language}/${fixedNS || ns}.json`;
};
}