mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
Implemented language switch in Interface Config Tab
This commit is contained in:
@@ -14,6 +14,7 @@ import mobileAnalytics from 'browser/main/lib/AwsMobileAnalyticsConfig'
|
||||
import eventEmitter from 'browser/main/lib/eventEmitter'
|
||||
import { hashHistory } from 'react-router'
|
||||
import store from 'browser/main/store'
|
||||
import i18n from 'browser/lib/i18n'
|
||||
const path = require('path')
|
||||
const electron = require('electron')
|
||||
const { remote } = electron
|
||||
@@ -148,7 +149,14 @@ class Main extends React.Component {
|
||||
} else {
|
||||
document.body.setAttribute('data-theme', 'default')
|
||||
}
|
||||
|
||||
if (config.ui.language === 'en') {
|
||||
i18n.setLocale('en')
|
||||
} else if (config.ui.language === 'de') {
|
||||
i18n.setLocale('de')
|
||||
} else {
|
||||
i18n.setLocale('fr')
|
||||
}
|
||||
|
||||
// Reload all data
|
||||
dataApi.init()
|
||||
.then((data) => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import _ from 'lodash'
|
||||
import RcParser from 'browser/lib/RcParser'
|
||||
import i18n from 'browser/lib/i18n'
|
||||
|
||||
const OSX = global.process.platform === 'darwin'
|
||||
const win = global.process.platform === 'win32'
|
||||
@@ -132,6 +133,14 @@ function set (updates) {
|
||||
document.body.setAttribute('data-theme', 'default')
|
||||
}
|
||||
|
||||
if (newConfig.ui.language === 'en') {
|
||||
i18n.setLocale('en')
|
||||
} else if (newConfig.ui.language === 'de') {
|
||||
i18n.setLocale('de')
|
||||
} else {
|
||||
i18n.setLocale('fr')
|
||||
}
|
||||
|
||||
let editorTheme = document.getElementById('editorTheme')
|
||||
if (editorTheme == null) {
|
||||
editorTheme = document.createElement('link')
|
||||
|
||||
@@ -62,6 +62,7 @@ class UiTab extends React.Component {
|
||||
const newConfig = {
|
||||
ui: {
|
||||
theme: this.refs.uiTheme.value,
|
||||
language: this.refs.uiLanguage.value,
|
||||
showCopyNotification: this.refs.showCopyNotification.checked,
|
||||
confirmDeletion: this.refs.confirmDeletion.checked,
|
||||
disableDirectWrite: this.refs.uiD2w != null
|
||||
@@ -168,6 +169,21 @@ class UiTab extends React.Component {
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div styleName='group-section'>
|
||||
{i18n.__('Language')}
|
||||
<div styleName='group-section-control'>
|
||||
<select value={config.ui.language}
|
||||
onChange={(e) => this.handleUIChange(e)}
|
||||
ref='uiLanguage'
|
||||
>
|
||||
<option value='en'>{i18n.__('English')}</option>
|
||||
<option value='de'>{i18n.__('German')}</option>
|
||||
<option value='fr'>{i18n.__('French')}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div styleName='group-checkBoxSection'>
|
||||
<label>
|
||||
<input onChange={(e) => this.handleUIChange(e)}
|
||||
@@ -175,7 +191,7 @@ class UiTab extends React.Component {
|
||||
ref='showCopyNotification'
|
||||
type='checkbox'
|
||||
/>
|
||||
{i18n.__('Show "Saved to Clipboard" notification when copying')}
|
||||
{i18n.__('Show "Saved to Clipboard" notification when copying')}
|
||||
</label>
|
||||
</div>
|
||||
<div styleName='group-checkBoxSection'>
|
||||
|
||||
@@ -90,5 +90,10 @@
|
||||
"If you like this project and see its potential, you can help by supporting us on OpenCollective!": "If you like this project and see its potential, you can help by supporting us on OpenCollective!",
|
||||
"Thanks,": "Thanks,",
|
||||
"Boostnote maintainers": "Boostnote maintainers",
|
||||
"Support via OpenCollective": "Support via OpenCollective"
|
||||
"Support via OpenCollective": "Support via OpenCollective",
|
||||
"Language": "Language",
|
||||
"English": "Englisch",
|
||||
"German": "Deutsch",
|
||||
"French": "Französisch",
|
||||
"Show \"Saved to Clipboard\" notification when copying": "Show \"Saved to Clipboard\" notification when copying"
|
||||
}
|
||||
@@ -27,7 +27,6 @@
|
||||
"Thanks,": "Thanks,",
|
||||
"Boostnote maintainers": "Boostnote maintainers",
|
||||
"Support via OpenCollective": "Support via OpenCollective",
|
||||
"Thank you for using Boostnote!": "Thank you for using Boostnote!",
|
||||
"Make a note": "Make a note",
|
||||
"Ctrl": "Ctrl",
|
||||
"Notes": "Notes",
|
||||
@@ -92,5 +91,9 @@
|
||||
"LaTeX Inline Close Delimiter": "LaTeX Inline Close Delimiter",
|
||||
"LaTeX Block Open Delimiter": "LaTeX Block Open Delimiter",
|
||||
"LaTeX Block Close Delimiter": "LaTeX Block Close Delimiter",
|
||||
".html": ".html"
|
||||
"Show \"Saved to Clipboard\" notification when copying": "Show \"Saved to Clipboard\" notification when copying",
|
||||
"Language": "Language",
|
||||
"English": "English",
|
||||
"German": "German",
|
||||
"French": "French"
|
||||
}
|
||||
@@ -1 +1,60 @@
|
||||
{}
|
||||
{
|
||||
"Notes": "Notes",
|
||||
"Tags": "Tags",
|
||||
"Preferences": "Preferences",
|
||||
"Make a note": "Make a note",
|
||||
"Ctrl": "Ctrl",
|
||||
"Toggle Mode": "Toggle Mode",
|
||||
"Trash": "Trash",
|
||||
"MODIFICATION DATE": "MODIFICATION DATE",
|
||||
"Words": "Words",
|
||||
"Letters": "Letters",
|
||||
"STORAGE": "STORAGE",
|
||||
"FOLDER": "FOLDER",
|
||||
"CREATION DATE": "CREATION DATE",
|
||||
"NOTE LINK": "NOTE LINK",
|
||||
".md": ".md",
|
||||
".txt": ".txt",
|
||||
".html": ".html",
|
||||
"Print": "Print",
|
||||
"Your preferences for Boostnote": "Your preferences for Boostnote",
|
||||
"Interface": "Interface",
|
||||
"Interface Theme": "Interface Theme",
|
||||
"Default": "Default",
|
||||
"White": "White",
|
||||
"Solarized Dark": "Solarized Dark",
|
||||
"Dark": "Dark",
|
||||
"Language": "Language",
|
||||
"English": "English",
|
||||
"German": "German",
|
||||
"French": "French",
|
||||
"Show \"Saved to Clipboard\" notification when copying": "Show \"Saved to Clipboard\" notification when copying",
|
||||
"Show a confirmation dialog when deleting notes": "Show a confirmation dialog when deleting notes",
|
||||
"Editor Theme": "Editor Theme",
|
||||
"Editor Font Size": "Editor Font Size",
|
||||
"Editor Font Family": "Editor Font Family",
|
||||
"Editor Indent Style": "Editor Indent Style",
|
||||
"Spaces": "Spaces",
|
||||
"Tabs": "Tabs",
|
||||
"Switch to Preview": "Switch to Preview",
|
||||
"When Editor Blurred": "When Editor Blurred",
|
||||
"When Editor Blurred, Edit On Double Click": "When Editor Blurred, Edit On Double Click",
|
||||
"On Right Click": "On Right Click",
|
||||
"Editor Keymap": "Editor Keymap",
|
||||
"default": "default",
|
||||
"vim": "vim",
|
||||
"emacs": "emacs",
|
||||
"⚠️ Please restart boostnote after you change the keymap": "⚠️ Please restart boostnote after you change the keymap",
|
||||
"Show line numbers in the editor": "Show line numbers in the editor",
|
||||
"Allow editor to scroll past the last line": "Allow editor to scroll past the last line",
|
||||
"Bring in web page title when pasting URL on editor": "Bring in web page title when pasting URL on editor",
|
||||
"Preview Font Size": "Preview Font Size",
|
||||
"Preview Font Family": "Preview Font Family",
|
||||
"Code block Theme": "Code block Theme",
|
||||
"Allow preview to scroll past the last line": "Allow preview to scroll past the last line",
|
||||
"Show line numbers for preview code blocks": "Show line numbers for preview code blocks",
|
||||
"LaTeX Inline Open Delimiter": "LaTeX Inline Open Delimiter",
|
||||
"LaTeX Inline Close Delimiter": "LaTeX Inline Close Delimiter",
|
||||
"LaTeX Block Open Delimiter": "LaTeX Block Open Delimiter",
|
||||
"LaTeX Block Close Delimiter": "LaTeX Block Close Delimiter"
|
||||
}
|
||||
Reference in New Issue
Block a user