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
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
trim_trailing_whitespace = true
|
||||
|
|
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'
|
||||
|
||||
const defaultCode = 'en-us'
|
||||
let $localStore = null
|
||||
|
||||
const languageCodeMap = {
|
||||
'cs': { label: 'Čeština', dateFnsLocale: 'cs' },
|
||||
'da': { label: 'Dansk', dateFnsLocale: 'da' },
|
||||
'de': { label: 'Deutsch', dateFnsLocale: 'de' },
|
||||
cs: { label: 'Čeština', dateFnsLocale: 'cs' },
|
||||
da: { label: 'Dansk', dateFnsLocale: 'da' },
|
||||
de: { label: 'Deutsch', dateFnsLocale: 'de' },
|
||||
'en-us': { label: 'English', dateFnsLocale: 'enUS' },
|
||||
'es': { label: 'Español', dateFnsLocale: 'es' },
|
||||
'fi': { label: 'Suomi', dateFnsLocale: 'fi' },
|
||||
'fr': { label: 'Français', dateFnsLocale: 'fr' },
|
||||
'hr': { label: 'Hrvatski', dateFnsLocale: 'hr' },
|
||||
'it': { label: 'Italiano', dateFnsLocale: 'it' },
|
||||
'lt': { label: 'Lietuvių', dateFnsLocale: 'lt' },
|
||||
'hu': { label: 'Magyar', dateFnsLocale: 'hu' },
|
||||
'nl': { label: 'Nederlands', dateFnsLocale: 'nl' },
|
||||
'no': { label: 'Norsk', dateFnsLocale: 'no' },
|
||||
'pl': { label: 'Polski', dateFnsLocale: 'pl' },
|
||||
es: { label: 'Español', dateFnsLocale: 'es' },
|
||||
fi: { label: 'Suomi', dateFnsLocale: 'fi' },
|
||||
fr: { label: 'Français', dateFnsLocale: 'fr' },
|
||||
hr: { label: 'Hrvatski', dateFnsLocale: 'hr' },
|
||||
it: { label: 'Italiano', dateFnsLocale: 'it' },
|
||||
lt: { label: 'Lietuvių', dateFnsLocale: 'lt' },
|
||||
hu: { label: 'Magyar', dateFnsLocale: 'hu' },
|
||||
nl: { label: 'Nederlands', dateFnsLocale: 'nl' },
|
||||
no: { label: 'Norsk', dateFnsLocale: 'no' },
|
||||
pl: { label: 'Polski', dateFnsLocale: 'pl' },
|
||||
'pt-br': { label: 'Português (Brasil)', dateFnsLocale: 'ptBR' },
|
||||
'ru': { label: 'Русский', dateFnsLocale: 'ru' },
|
||||
'sv': { label: 'Svenska', dateFnsLocale: 'sv' },
|
||||
'uk': { label: 'Українська', dateFnsLocale: 'uk' },
|
||||
ru: { label: 'Русский', dateFnsLocale: 'ru' },
|
||||
sv: { label: 'Svenska', dateFnsLocale: 'sv' },
|
||||
uk: { label: 'Українська', dateFnsLocale: 'uk' },
|
||||
'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) {
|
||||
// source: http://crockford.com/javascript/remedial.html
|
||||
return str.replace(/{([^{}]*)}/g,
|
||||
function (a, b) {
|
||||
return str.replace(/{([^{}]*)}/g, function (a, b) {
|
||||
var r = subs[b]
|
||||
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 {
|
||||
text: languageCodeMap[code].label,
|
||||
value: code
|
||||
|
@ -67,9 +65,11 @@ var translations = {
|
|||
|
||||
function loadTranslationStrings(code) {
|
||||
return new Promise((resolve) => {
|
||||
import(`../strings/${code}`).then((fileContents) => {
|
||||
import(`../strings/${code}`)
|
||||
.then((fileContents) => {
|
||||
resolve(fileContents.default)
|
||||
}).catch((error) => {
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Failed to load i18n strings', code, error)
|
||||
resolve(null)
|
||||
})
|
||||
|
@ -83,7 +83,7 @@ async function loadi18n(code) {
|
|||
return false
|
||||
}
|
||||
|
||||
const strings = translations[code] || await loadTranslationStrings(code)
|
||||
const strings = translations[code] || (await loadTranslationStrings(code))
|
||||
if (!strings) {
|
||||
console.warn(`Invalid lang code ${code}`)
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue