mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-06-20 20:05:44 +02:00
Update:Editor config/vscode settings/prettierrc
This commit is contained in:
parent
c52a60fe77
commit
e79d09941c
5 changed files with 84 additions and 38 deletions
|
@ -1,13 +1,8 @@
|
||||||
# editorconfig.org
|
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
[*.md]
|
|
||||||
trim_trailing_whitespace = false
|
|
||||||
|
|
17
.prettierrc
Normal file
17
.prettierrc
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"printWidth": 400,
|
||||||
|
"proseWrap": "never",
|
||||||
|
"trailingComma": "none",
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["*.html"],
|
||||||
|
"options": {
|
||||||
|
"singleQuote": false,
|
||||||
|
"wrapAttributes": false,
|
||||||
|
"sortAttributes": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
7
.vscode/extensions.json
vendored
Normal file
7
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"EditorConfig.EditorConfig",
|
||||||
|
"esbenp.prettier-vscode",
|
||||||
|
"octref.vetur"
|
||||||
|
]
|
||||||
|
}
|
27
.vscode/settings.json
vendored
Normal file
27
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"vetur.format.defaultFormatterOptions": {
|
||||||
|
"prettier": {
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"printWidth": 400,
|
||||||
|
"proseWrap": "never",
|
||||||
|
"trailingComma": "none"
|
||||||
|
},
|
||||||
|
"prettyhtml": {
|
||||||
|
"printWidth": 400,
|
||||||
|
"singleQuote": false,
|
||||||
|
"wrapAttributes": false,
|
||||||
|
"sortAttributes": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.detectIndentation": true,
|
||||||
|
"editor.tabSize": 2,
|
||||||
|
"javascript.format.semicolons": "remove",
|
||||||
|
"[javascript][json][jsonc]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[vue]": {
|
||||||
|
"editor.defaultFormatter": "octref.vetur"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,43 +1,41 @@
|
||||||
import Vue from "vue"
|
import Vue from 'vue'
|
||||||
import enUsStrings from '../strings/en-us.json'
|
import enUsStrings from '../strings/en-us.json'
|
||||||
|
|
||||||
const defaultCode = 'en-us'
|
const defaultCode = 'en-us'
|
||||||
let $localStore = null
|
let $localStore = null
|
||||||
|
|
||||||
const languageCodeMap = {
|
const languageCodeMap = {
|
||||||
'cs': { label: 'Čeština', dateFnsLocale: 'cs' },
|
cs: { label: 'Čeština', dateFnsLocale: 'cs' },
|
||||||
'da': { label: 'Dansk', dateFnsLocale: 'da' },
|
da: { label: 'Dansk', dateFnsLocale: 'da' },
|
||||||
'de': { label: 'Deutsch', dateFnsLocale: 'de' },
|
de: { label: 'Deutsch', dateFnsLocale: 'de' },
|
||||||
'en-us': { label: 'English', dateFnsLocale: 'enUS' },
|
'en-us': { label: 'English', dateFnsLocale: 'enUS' },
|
||||||
'es': { label: 'Español', dateFnsLocale: 'es' },
|
es: { label: 'Español', dateFnsLocale: 'es' },
|
||||||
'fi': { label: 'Suomi', dateFnsLocale: 'fi' },
|
fi: { label: 'Suomi', dateFnsLocale: 'fi' },
|
||||||
'fr': { label: 'Français', dateFnsLocale: 'fr' },
|
fr: { label: 'Français', dateFnsLocale: 'fr' },
|
||||||
'hr': { label: 'Hrvatski', dateFnsLocale: 'hr' },
|
hr: { label: 'Hrvatski', dateFnsLocale: 'hr' },
|
||||||
'it': { label: 'Italiano', dateFnsLocale: 'it' },
|
it: { label: 'Italiano', dateFnsLocale: 'it' },
|
||||||
'lt': { label: 'Lietuvių', dateFnsLocale: 'lt' },
|
lt: { label: 'Lietuvių', dateFnsLocale: 'lt' },
|
||||||
'hu': { label: 'Magyar', dateFnsLocale: 'hu' },
|
hu: { label: 'Magyar', dateFnsLocale: 'hu' },
|
||||||
'nl': { label: 'Nederlands', dateFnsLocale: 'nl' },
|
nl: { label: 'Nederlands', dateFnsLocale: 'nl' },
|
||||||
'no': { label: 'Norsk', dateFnsLocale: 'no' },
|
no: { label: 'Norsk', dateFnsLocale: 'no' },
|
||||||
'pl': { label: 'Polski', dateFnsLocale: 'pl' },
|
pl: { label: 'Polski', dateFnsLocale: 'pl' },
|
||||||
'pt-br': { label: 'Português (Brasil)', dateFnsLocale: 'ptBR' },
|
'pt-br': { label: 'Português (Brasil)', dateFnsLocale: 'ptBR' },
|
||||||
'ru': { label: 'Русский', dateFnsLocale: 'ru' },
|
ru: { label: 'Русский', dateFnsLocale: 'ru' },
|
||||||
'sv': { label: 'Svenska', dateFnsLocale: 'sv' },
|
sv: { label: 'Svenska', dateFnsLocale: 'sv' },
|
||||||
'uk': { label: 'Українська', dateFnsLocale: 'uk' },
|
uk: { label: 'Українська', dateFnsLocale: 'uk' },
|
||||||
'vi-vn': { label: 'Tiếng Việt', dateFnsLocale: 'vi' },
|
'vi-vn': { label: 'Tiếng Việt', dateFnsLocale: 'vi' },
|
||||||
'zh-cn': { label: '简体中文 (Simplified Chinese)', dateFnsLocale: 'zhCN' },
|
'zh-cn': { label: '简体中文 (Simplified Chinese)', dateFnsLocale: 'zhCN' }
|
||||||
}
|
}
|
||||||
|
|
||||||
function supplant(str, subs) {
|
function supplant(str, subs) {
|
||||||
// source: http://crockford.com/javascript/remedial.html
|
// source: http://crockford.com/javascript/remedial.html
|
||||||
return str.replace(/{([^{}]*)}/g,
|
return str.replace(/{([^{}]*)}/g, function (a, b) {
|
||||||
function (a, b) {
|
var r = subs[b]
|
||||||
var r = subs[b]
|
return typeof r === 'string' || typeof r === 'number' ? r : a
|
||||||
return typeof r === 'string' || typeof r === 'number' ? r : a
|
})
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vue.prototype.$languageCodeOptions = Object.keys(languageCodeMap).map(code => {
|
Vue.prototype.$languageCodeOptions = Object.keys(languageCodeMap).map((code) => {
|
||||||
return {
|
return {
|
||||||
text: languageCodeMap[code].label,
|
text: languageCodeMap[code].label,
|
||||||
value: code
|
value: code
|
||||||
|
@ -67,12 +65,14 @@ var translations = {
|
||||||
|
|
||||||
function loadTranslationStrings(code) {
|
function loadTranslationStrings(code) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
import(`../strings/${code}`).then((fileContents) => {
|
import(`../strings/${code}`)
|
||||||
resolve(fileContents.default)
|
.then((fileContents) => {
|
||||||
}).catch((error) => {
|
resolve(fileContents.default)
|
||||||
console.error('Failed to load i18n strings', code, error)
|
})
|
||||||
resolve(null)
|
.catch((error) => {
|
||||||
})
|
console.error('Failed to load i18n strings', code, error)
|
||||||
|
resolve(null)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ async function loadi18n(code) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const strings = translations[code] || await loadTranslationStrings(code)
|
const strings = translations[code] || (await loadTranslationStrings(code))
|
||||||
if (!strings) {
|
if (!strings) {
|
||||||
console.warn(`Invalid lang code ${code}`)
|
console.warn(`Invalid lang code ${code}`)
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue