Skip to content

Commit

Permalink
Move translations to JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
hrynko committed Feb 18, 2023
1 parent 80d86fc commit fb974b7
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 86 deletions.
77 changes: 26 additions & 51 deletions src/components/MarkdownEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -520,93 +520,105 @@ export default defineComponent({
action: () => toggleHeading(codeMirror),
className: 'fa fa-header',
name: 'heading',
tooltip: `${t('heading')} (${shortcuts.toggleHeading})`,
tooltip: `${t('MarkdownEditor.heading')} (${
shortcuts.toggleHeading
})`,
},
{
action: () => toggleBold(codeMirror),
className: 'fa fa-bold',
name: 'bold',
tooltip: `${t('bold')} (${shortcuts.toggleBold})`,
tooltip: `${t('MarkdownEditor.bold')} (${shortcuts.toggleBold})`,
},
{
action: () => toggleItalic(codeMirror),
className: 'fa fa-italic',
name: 'italic',
tooltip: `${t('italic')} (${shortcuts.toggleItalic})`,
tooltip: `${t('MarkdownEditor.italic')} (${shortcuts.toggleItalic})`,
},
{
action: () => toggleStrikethrough(codeMirror),
className: 'fa fa-strikethrough',
name: 'strikethrough',
tooltip: t('strikethrough'),
tooltip: t('MarkdownEditor.strikethrough'),
},
],
[
{
action: () => toggleOrderedList(codeMirror),
className: 'fa fa-list-ol',
name: 'orderedList',
tooltip: `${t('orderedList')} (${shortcuts.toggleOrderedList})`,
tooltip: `${t('MarkdownEditor.orderedList')} (${
shortcuts.toggleOrderedList
})`,
},
{
action: () => toggleUnorderedList(codeMirror),
className: 'fa fa-list-ul',
name: 'unorderedList',
tooltip: `${t('unorderedList')} (${shortcuts.toggleUnorderedList})`,
tooltip: `${t('MarkdownEditor.unorderedList')} (${
shortcuts.toggleUnorderedList
})`,
},
{
action: () => toggleBlockquote(codeMirror),
className: 'fa fa-quote-right',
name: 'quote',
tooltip: `${t('quote')} (${shortcuts.toggleBlockquote})`,
tooltip: `${t('MarkdownEditor.quote')} (${
shortcuts.toggleBlockquote
})`,
},
],
[
{
action: () => insertLink(codeMirror),
className: 'fa fa-link',
name: 'link',
tooltip: `${t('link')} (${shortcuts.insertLink})`,
tooltip: `${t('MarkdownEditor.link')} (${shortcuts.insertLink})`,
},
{
action: () => insertImage(codeMirror),
className: 'fa fa-image',
name: 'image',
tooltip: `${t('image')} (${shortcuts.insertImage})`,
tooltip: `${t('MarkdownEditor.image')} (${shortcuts.insertImage})`,
},
{
action: () => insertTable(codeMirror),
className: 'fa fa-table',
name: 'table',
tooltip: `${t('table')} (${shortcuts.insertImage})`,
tooltip: `${t('MarkdownEditor.table')} (${shortcuts.insertImage})`,
},
{
action: () => insertHorizontalRule(codeMirror),
className: 'fa fa-minus',
name: 'horizontalRule',
tooltip: `${t('horizontalRule')} (${shortcuts.insertImage})`,
tooltip: `${t('MarkdownEditor.horizontalRule')} (${
shortcuts.insertImage
})`,
},
],
[
{
action: () => cleanBlock(codeMirror),
className: 'fa fa-eraser fa-clean-block',
name: 'cleanBlock',
tooltip: `${t('cleanBlock')} (${shortcuts.cleanBlock})`,
tooltip: `${t('MarkdownEditor.cleanBlock')} (${
shortcuts.cleanBlock
})`,
},
],
[
{
action: () => undo(codeMirror),
className: 'fa fa-rotate-left no-disable',
name: 'undo',
tooltip: t('undo'),
tooltip: t('MarkdownEditor.undo'),
},
{
action: () => redo(codeMirror),
className: 'fa fa-rotate-right no-disable',
name: 'redo',
tooltip: t('redo'),
tooltip: t('MarkdownEditor.redo'),
},
],
])
Expand All @@ -620,43 +632,6 @@ export default defineComponent({
})
</script>

<i18n>
{
"be": {
"bold": "Toŭsty",
"cleanBlock": "Ačyścić błok",
"heading": "Zahałovak",
"horizontalRule": "Ustavić haryzantalnuju liniju",
"image": "Ustavić vyjavu",
"italic": "Kursyŭny",
"link": "Ustavić spasyłku",
"orderedList": "Numaravany śpis",
"quote": "Cytata",
"redo": "Paŭtaryć",
"strikethrough": "Zakreśleny",
"table": "Ustavić tablicu",
"undo": "Admianić",
"unorderedList": "Markavany śpis"
},
"en": {
"bold": "Bold",
"cleanBlock": "Clean Block",
"heading": "Heading",
"horizontalRule": "Insert Horizontal Line",
"image": "Insert Image",
"italic": "Italic",
"link": "Insert Link",
"orderedList": "Numbered List",
"quote": "Quote",
"redo": "Redo",
"strikethrough": "Strikethrough",
"table": "Insert Table",
"undo": "Undo",
"unorderedList": "Bulleted List"
}
}
</i18n>

<style lang="scss" scoped>
.markdown-editor {
display: flex;
Expand Down
25 changes: 4 additions & 21 deletions src/components/NavigationBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
:class="{ active: activeGroup === 'file' }"
@click="handleGroupClick('file')"
>
{{ t('file') }}
{{ t('NavigationBar.file') }}

<ul>
<li role="button" @click="$emit('upload')">
<span>{{ t('open') }}</span>
<span>{{ t('NavigationBar.open') }}</span>
</li>

<li role="button" @click="$emit('download')">
<span>{{ t('downloadAsMD') }}</span>
<span>{{ t('NavigationBar.downloadAsMD') }}</span>
</li>

<li role="button" @click="$emit('export')">
<span>{{ t('exportAsPDF') }}</span>
<span>{{ t('NavigationBar.exportAsPDF') }}</span>
</li>
</ul>
</li>
Expand Down Expand Up @@ -87,23 +87,6 @@ export default defineComponent({
})
</script>

<i18n>
{
"be": {
"downloadAsMD": "Spampavać jak Markdown",
"exportAsPDF": "Ekspartavać jak PDF",
"file": "Fajł",
"open": "Adkryć Markdown fajł"
},
"en": {
"downloadAsMD": "Download as Markdown",
"exportAsPDF": "Export as PDF",
"file": "File",
"open": "Open Markdown file"
}
}
</i18n>

<style lang="scss" scoped>
.navigation-bar {
display: flex;
Expand Down
26 changes: 25 additions & 1 deletion src/i18n/locales/be.json
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
{}
{
"MarkdownEditor": {
"bold": "Toŭsty",
"cleanBlock": "Ačyścić błok",
"heading": "Zahałovak",
"horizontalRule": "Ustavić haryzantalnuju liniju",
"image": "Ustavić vyjavu",
"italic": "Kursyŭny",
"link": "Ustavić spasyłku",
"orderedList": "Numaravany śpis",
"placeholder": "Pačnicie nabirać tekst tut...",
"quote": "Cytata",
"redo": "Paŭtaryć",
"strikethrough": "Zakreśleny",
"table": "Ustavić tablicu",
"undo": "Admianić",
"unorderedList": "Markavany śpis"
},
"NavigationBar": {
"downloadAsMD": "Spampavać jak Markdown",
"exportAsPDF": "Ekspartavać jak PDF",
"file": "Fajł",
"open": "Adkryć Markdown fajł"
}
}
26 changes: 25 additions & 1 deletion src/i18n/locales/en.json
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
{}
{
"MarkdownEditor": {
"bold": "Bold",
"cleanBlock": "Clean Block",
"heading": "Heading",
"horizontalRule": "Insert Horizontal Line",
"image": "Insert Image",
"italic": "Italic",
"link": "Insert Link",
"orderedList": "Numbered List",
"placeholder": "Start typing here...",
"quote": "Quote",
"redo": "Redo",
"strikethrough": "Strikethrough",
"table": "Insert Table",
"undo": "Undo",
"unorderedList": "Bulleted List"
},
"NavigationBar": {
"downloadAsMD": "Download as Markdown",
"exportAsPDF": "Export as PDF",
"file": "File",
"open": "Open Markdown file"
}
}
13 changes: 1 addition & 12 deletions src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<div class="home-view__split">
<MarkdownEditor
:placeholder="t('editorPlaceholder')"
:placeholder="t('MarkdownEditor.placeholder')"
:value="contentOpened"
@input="content = $event"
/>
Expand Down Expand Up @@ -122,17 +122,6 @@ export default defineComponent({
})
</script>

<i18n>
{
"be": {
"editorPlaceholder": "Pačnicie nabirać tekst tut..."
},
"en": {
"editorPlaceholder": "Start typing here..."
}
}
</i18n>

<style lang="scss" scoped>
@import '@/styles/variables';
@import '@/styles/mixins';
Expand Down

0 comments on commit fb974b7

Please sign in to comment.