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:
parent
0d4b75c367
commit
db25f4100c
5 changed files with 22 additions and 1 deletions
|
@ -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();
|
Loading…
Add table
Add a link
Reference in a new issue