Skip to content

Commit

Permalink
feat: polish locale, project level DEFAULT_LOCALE
Browse files Browse the repository at this point in the history
  • Loading branch information
qyloxe committed Apr 25, 2020
1 parent 7fe1e57 commit 419807a
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ yarn-error.log*
*.ntvs*
*.njsproj
*.sln

# Package-Lock from NPM - please review and decide
package-lock.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A modern WYSIWYG rich-text editor built on top of [tiptap](https://github.com/sc
- Extensions: tiptap official extensions, and dozens of great extensions
- Markdown
- Diagram and LaTex Math formula
- I18n support (`en-us`, `zh-hans`)
- I18n support (`en-us`, `pl`, `zh-hans`)
- Fully extensible for editor extensions, menubar

## Installation
Expand Down
7 changes: 6 additions & 1 deletion quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// https://quasar.dev/quasar-cli/quasar-conf-js

module.exports = function (ctx) {
const DEFAULT_LOCALE = 'en-us'
const appenv = {
DEFAULT_LOCALE: JSON.stringify(DEFAULT_LOCALE)
}
return {
// app boot file (/src/boot)
// --> boot files are part of "main.js"
Expand All @@ -26,7 +30,7 @@ module.exports = function (ctx) {
// https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-framework
framework: {
iconSet: 'material-icons', // Quasar icon set
lang: 'en-us', // Quasar language pack
lang: DEFAULT_LOCALE, // Quasar language pack

// Possible values for "all":
// * 'auto' - Auto-import needed Quasar components & directives
Expand Down Expand Up @@ -89,6 +93,7 @@ module.exports = function (ctx) {
vueCompiler: true,
distDir: 'dist/' + ctx.modeName,
publicPath: 'quasar-tiptap',
env: appenv,

// rtl: false, // https://quasar.dev/options/rtl-support
// showProgress: false,
Expand Down
16 changes: 11 additions & 5 deletions src/i18n/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import enUS from './en-us'
import zhHans from './zh-hans'
import lang_enUS from './en-us'
import lang_pl from './pl'
import lang_zhHans from './zh-hans'

const defaultLang = enUS
const langList = {
'en-us': enUS,
'zh-hans': zhHans
'en-us': lang_enUS,
// eslint-disable-next-line quote-props
'pl': lang_pl,
'zh-hans': lang_zhHans
}

// use this const as initial language setting in demo/testing purposes (should be dynamic BTW, currently it comes from quasar.conf.js):
export const DEFAULT_LOCALE = process.env.DEFAULT_LOCALE || 'en-us'
const defaultLang = langList[DEFAULT_LOCALE]

export const getLang = (language) => {
return langList[language] || defaultLang
}
Expand Down
102 changes: 102 additions & 0 deletions src/i18n/pl/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
export default {
isoName: 'pl',
nativeName: 'Polski',
diagram: {
name: 'Schemat tekstowy',
flow: 'Schemat przepływu',
sequence: 'Schemat sekwencji',
class: 'Schemat klas',
state: 'Diagram stanu',
gantt: 'Diagram Gantta',
tips: 'Generowanie diagramu i wykresu z tekstu w podobny sposób jak markdown',
},
editor: {
add: 'Dodaj',
addMore: 'Dodaj więcej',
url: 'URL',
bold: 'Pogrubienie',
italic: 'Kursywa',
strikethrough: 'Przekreślenie',
underline: 'Podkreślenie',
unorderedList: 'Lista wypunktowana',
orderedList: 'Lista numerowana',
todoList: 'Lista rzeczy do zrobienia',
subscript: 'Indeks dolny',
superscript: 'Indeks górny',
hyperlink: 'Hiperłącze',
toggleFullscreen: 'Przełącz na tryb pełnoekranowy',
quote: 'Zacytuj',
left: 'Wyrównaj do lewej',
center: 'Wyrównaj do środka',
right: 'Wyrównaj do prawej',
justify: 'Wyjustuj',
print: 'Drukuj',
outdent: 'Zmniejsz wcięcie',
indent: 'Zwiększ wcięcie',
removeFormat: 'Usuń formatowanie',
formatting: 'Formatowanie',
fontFamily: 'Nazwa czcionki',
defaultFont: 'Domyślna czcionka',
fontSize: 'Rozmiar czcionki',
align: 'Wyrównanie',
hr: 'Wstaw poziomą linię',
undo: 'Cofnij',
redo: 'Przywróć',
heading1: 'Nagłówek 1',
heading2: 'Nagłówek 2',
heading3: 'Nagłówek 3',
heading4: 'Nagłówek 4',
heading5: 'Nagłówek 5',
headings: 'Nagłówki',
paragraph: 'Paragraf',
code: 'Kod',
codeBlock: 'Blok kodu',
size1: 'Bardzo mała',
size2: 'Mała',
size3: 'Normalna',
size4: 'Średnio-duża',
size5: 'Duża',
size6: 'Bardzo duża',
size7: 'Maksymalna',
viewSource: 'Pokaż źródło',
textColor: 'Kolor czcionki',
highlightColor: 'Kolor wyróżnienia',
default: 'Dymyślny',
lineHeight: 'Wysokość linii',
blockquote: 'Cytat',
table: 'Tabela',
photo: 'Wstaw obraz',
formula: 'Formuła',
inlineFormula: 'Formuła w treści',
blockFormula: 'Blokowa formuła',
},
label: {
cancel: 'Anuluj',
edit: 'Edycja',
link: 'Łącze',
linkAddress: 'Adres łącza',
ok: 'Ok',
preview: 'Podgląd',
template: 'Szablon',
},
table: {
insert: 'Wstaw tabelę',
remove: 'Usuń tabelę',
insertColumnLeft: 'Wstaw kolumnę przed',
insertColumnRight: 'Wstaw kolumnę po',
removeColumns: 'Usuń zaznaczone kolumny',
insertRowUp: 'Wstaw wiersz powyżej',
insertRowDown: 'Wstaw wiersz poniżej',
removeRows: 'Usuń zaznaczone wiersze',
merge: 'Scal/podziel komórki',
},
image: {
preferences: 'Preferencje obrazu',
size: 'Rozmiar',
width: 'Szerokość',
height: 'Wysokość',
src: 'Źródło obrazu',
caption: 'Nagłówek',
link: 'Łącze',
}
}
5 changes: 3 additions & 2 deletions src/pages/examples/all.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
<script>
import Vue from 'vue'
import { QuasarTiptapPlugin, OMenubarBtn } from 'src/index'
import { DEFAULT_LOCALE } from 'src/i18n'
Vue.use(QuasarTiptapPlugin, {
language: 'en-us',
language: DEFAULT_LOCALE,
spellcheck: true
})
Expand Down Expand Up @@ -76,7 +77,7 @@ export default {
onSlideShow () {}
},
mounted () {
this.$o.lang.set('en-us')
this.$o.lang.set(DEFAULT_LOCALE)
},
deactivated () {
},
Expand Down
4 changes: 3 additions & 1 deletion src/pages/examples/basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import { BasicFeaturesArticle, BasicFeaturesArticleJson } from 'src/data/article
import OAddMoreBtn from 'src/components/buttons/OAddMoreBtn'
import { DEFAULT_LOCALE } from 'src/i18n'
export default {
name: 'page-quasar-tiptap-basic',
data () {
Expand Down Expand Up @@ -100,7 +102,7 @@ export default {
}
},
mounted () {
this.$o.lang.set('en-us')
this.$o.lang.set(DEFAULT_LOCALE)
// console.log('editor', this.$refs.editor.editor)
},
deactivated () {
Expand Down

0 comments on commit 419807a

Please sign in to comment.