mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-28 16:19:48 +03:00
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:
1 parent
0d4267e356
commit
a8c6ebc81b
347 files changed
+10245
-4533
No files matched your search
@@ -1,9 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import JSON5 from 'json5';
|
||||
import type { UseValidationRule } from '@/composable/validation';
|
||||
import { isNotThrowing } from '@/utils/boolean';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
function parseJSON(value: string) {
|
||||
try {
|
||||
return JSON5.parse(value);
|
||||
@@ -19,7 +22,7 @@ const transformer = (value: string) => withDefaultOnError(() => JSON.stringify(p
|
||||
const rules: UseValidationRule<string>[] = [
|
||||
{
|
||||
validator: (value: string) => value === '' || isNotThrowing(() => JSON.stringify(parseJSON(value))),
|
||||
message: 'Provided JS Object is not valid.',
|
||||
message: t('tools.javascript-to-json.texts.message-provided-js-object-is-not-valid'),
|
||||
},
|
||||
];
|
||||
</script>
|
||||
@@ -27,16 +30,16 @@ const rules: UseValidationRule<string>[] = [
|
||||
<template>
|
||||
<div style="flex: 0 0 100%">
|
||||
<div style="margin: 0 auto;" flex justify-center gap-3>
|
||||
<n-form-item label="Indent size :" label-placement="left" label-width="100" :show-feedback="false">
|
||||
<n-form-item :label="t('tools.javascript-to-json.texts.label-indent-size')" label-placement="left" label-width="100" :show-feedback="false">
|
||||
<n-input-number v-model:value="indentSize" min="0" max="10" style="width: 100px" />
|
||||
</n-form-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<format-transformer
|
||||
input-label="Your JavaScript Object"
|
||||
input-placeholder="Paste your JS Object here..."
|
||||
output-label="JSON from your JavaScript Object"
|
||||
:input-label="t('tools.javascript-to-json.texts.input-label-your-javascript-object')"
|
||||
:input-placeholder="t('tools.javascript-to-json.texts.input-placeholder-paste-your-js-object-here')"
|
||||
:output-label="t('tools.javascript-to-json.texts.output-label-json-from-your-javascript-object')"
|
||||
output-language="json"
|
||||
:input-validation-rules="rules"
|
||||
:transformer="transformer"
|
||||
|
||||
Reference in new issue
Block a user