-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentry.es
69 lines (57 loc) · 1.67 KB
/
entry.es
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import 'views/env'
import i18n2 from 'i18n-2'
import path from 'path-extra'
import { remote } from 'electron'
import { debounce } from 'lodash'
const { config } = window
// eslint-disable-next-line new-cap
const i18n = new i18n2({
locales: ['en-US', 'ja-JP', 'zh-CN', 'zh-TW', 'ko-KR'],
defaultLocale: 'zh-CN',
directory: path.join(__dirname, 'assets', 'i18n'),
devMode: false,
extension: '.json',
})
i18n.setLocale(window.language)
if (i18n.resources == null) {
i18n.resources = {}
}
if (i18n.resources.__ == null) {
i18n.resources.__ = str => str
}
if (i18n.resources.translate == null) {
i18n.resources.translate = (_locale, str) => str
}
if (i18n.resources.setLocale == null) {
i18n.resources.setLocale = () => {}
}
window.i18n = i18n
try {
// eslint-disable-next-line global-require
require('poi-plugin-translator').pluginDidLoad()
} catch (error) {
console.info("failed to load poi-plugin-translator")
}
window.__ = i18n.__.bind(i18n)
window.__r = i18n.resources.__.bind(i18n.resources)
// augment font size with poi zoom level
const zoomLevel = config.get('poi.zoomLevel', 1)
const additionalStyle = document.createElement('style')
remote.getCurrentWindow().webContents.on('dom-ready', () => {
document.body.appendChild(additionalStyle)
})
additionalStyle.innerHTML = `
ship-info,
.info-tooltip {
font-size: ${zoomLevel * 100}%;
}
`
// remember window size
window.levelingWindow = remote.getCurrentWindow()
const rememberSize = debounce(() => {
const b = window.levelingWindow.getBounds()
config.set('plugin.Leveling.bounds', b)
}, 5000)
window.levelingWindow.on('move', rememberSize)
window.levelingWindow.on('resize', rememberSize)
require('./ui')