Feat/translate all content (#121)

* feat: add script to extract strings

* feat: extract many strings (html, attr, label)

* feat(extract string): extract html only for .vue and single file mode

* fix: __i18n_ally_root__

* feat: nestify en.yml + extract tab attributes

* feat: add script to extract strings

* feat: extract many strings (html, attr, label)

* feat(extract string): extract html only for .vue and single file mode

* fix: __i18n_ally_root__

* feat: nestify en.yml + extract tab attributes

* fix: lint

* feat: add vue-i18n-extract to check missing keys

* fix: unit tests

* fix: update vue i18n plugin
This commit is contained in:
sharevb authored and ShareVB committed 2025-07-20 21:01:01 +02:00
1 parent 0d4267e356
commit a8c6ebc81b
347 files changed
+10245 -4533

No files matched your search

@@ -1,20 +1,22 @@
import ICAL from 'ical.js';
import { translate as t } from '@/plugins/i18n.plugin';
export function parseQRData(qrContent: string | null) {
if (!qrContent) {
return { type: 'Unknown', value: '' };
return { type: t('tools.qr-code-decoder.service.text.unknown'), value: '' };
}
if (qrContent.startsWith('BEGIN:VCALENDAR')) {
return { type: 'iCal', value: ICAL.parse(qrContent?.trim()) };
return { type: t('tools.qr-code-decoder.service.text.ical'), value: ICAL.parse(qrContent?.trim()) };
}
if (qrContent.startsWith('TEL:')) {
return { type: 'Phone', value: qrContent.substring(4)?.trim() };
return { type: t('tools.qr-code-decoder.service.text.phone'), value: qrContent.substring(4)?.trim() };
}
if (qrContent.startsWith('MATMSG:')) {
// MATMSG:TO: email@example.com;SUB:email subject;BODY:Email text;;
const parsing = /^MATMSG:(?:TO:([^;]*);)?(?:SUB:([^;]*);)?(?:BODY:([^;]*))?;;$/.exec(qrContent) || [];
return {
type: 'Email',
type: t('tools.qr-code-decoder.service.text.email'),
value: {
to: parsing[1]?.trim(),
subject: parsing[2]?.trim(),
@@ -26,7 +28,7 @@ export function parseQRData(qrContent: string | null) {
// mailto:email@example.com?subject=email subject&body=Email text
const parsing = /^mailto:([^\?]+)\?subject=([^\&]*)(?:&body=(.*))$/.exec(qrContent) || [];
return {
type: 'Email',
type: t('tools.qr-code-decoder.service.text.email-0'),
value: {
to: parsing[1]?.trim(),
subject: parsing[2]?.trim(),
@@ -38,7 +40,7 @@ export function parseQRData(qrContent: string | null) {
// SMTP:email@example.com:email subject:Email text
const parsing = /^SMTP:([^:]+)(?::([^:]*))(?::([^:]*))?$/.exec(qrContent) || [];
return {
type: 'Email',
type: t('tools.qr-code-decoder.service.text.email-1'),
value: {
to: parsing[1]?.trim(),
subject: parsing[2]?.trim(),
@@ -50,7 +52,7 @@ export function parseQRData(qrContent: string | null) {
// smsto:${phoneNumber}:${message}
const parsing = /^smsto:([^:]+)(?::(.+))$/.exec(qrContent) || [];
return {
type: 'SMS',
type: t('tools.qr-code-decoder.service.text.sms'),
value: {
to: parsing[1]?.trim(),
message: parsing[2]?.trim(),
@@ -61,7 +63,7 @@ export function parseQRData(qrContent: string | null) {
// WIFI:T:${authentication};S:${name};${authentication !== 'nopass' ? `P:${password};` : ''}H:${hidden};
const parsing = /^WIFI:T:([^;]+);S:([^;]+);(?:P:([^;]+);)?(?:H:([^;]+);)?$/.exec(qrContent) || [];
return {
type: 'Wifi',
type: t('tools.qr-code-decoder.service.text.wifi'),
value: {
authentication: parsing[1]?.trim(),
name: parsing[2]?.trim(),
@@ -72,12 +74,12 @@ export function parseQRData(qrContent: string | null) {
}
if (/^(?:https?|ftp):\/\//.test(qrContent)) {
return {
type: 'Url',
type: t('tools.websocket-tester.texts.label-url'),
value: qrContent,
};
}
return {
type: 'Text',
type: t('tools.categories.text'),
value: qrContent,
};
}
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import type { Ref } from 'vue';
import qrcodeParser from 'qrcode-parser';
import { parseQRData } from './qr-code-decoder.service';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const { t } = useI18n();
const fileInput = ref() as Ref<File>;
const qrCode = computedAsync(async () => {
try {
@@ -33,7 +36,7 @@ async function onUpload(file: File) {
<template>
<div>
<c-file-upload
title="Drag and drop a QR Code here, or click to select a file"
:title="t('tools.qr-code-decoder.texts.title-drag-and-drop-a-qr-code-here-or-click-to-select-a-file')"
:paste-image="true"
@file-upload="onUpload"
/>
@@ -41,14 +44,14 @@ async function onUpload(file: File) {
<n-divider />
<div>
<h3>Decoded</h3>
<h3>{{ t('tools.qr-code-decoder.texts.tag-decoded') }}</h3>
<TextareaCopyable
:value="qrCode"
:word-wrap="true"
/>
</div>
<div>
<h3>Parsed</h3>
<h3>{{ t('tools.qr-code-decoder.texts.tag-parsed') }}</h3>
<TextareaCopyable
:value="qrCodeParsed"
:word-wrap="true"