1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

JS-2698: Electron strings localisationn

This commit is contained in:
Andrew Simachev 2023-07-28 15:11:27 +02:00
parent 0d4b75c367
commit db25f4100c
No known key found for this signature in database
GPG key ID: 49A163D0D14E6FD8
5 changed files with 22 additions and 1 deletions

View file

@ -1,4 +1,5 @@
const { app, shell, nativeTheme } = require('electron');
const { localStorage } = require('electron-browser-storage');
const { is } = require('electron-util');
const log = require('electron-log');
const path = require('path');
@ -206,6 +207,18 @@ class Util {
return sanitize(String(name || 'untitled').trim());
};
translate (key) {
let lang = 'en-US';
let data = {};
try {
lang = JSON.stringify(localStorage.getItem('interfaceLang'));
data = require(`lib/json/lang/${lang}.json`);
} catch(e) {};
return data[key] || `⚠️${key}⚠️`;
};
};
module.exports = new Util();