mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-29 00:29:42 +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,16 +1,19 @@
|
||||
<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();
|
||||
|
||||
const indentSize = useStorage('json-prettify:indent-size', 3);
|
||||
const transformer = (value: string) => withDefaultOnError(() => JSON5.stringify(JSON.parse(value), null, indentSize.value), '');
|
||||
|
||||
const rules: UseValidationRule<string>[] = [
|
||||
{
|
||||
validator: (value: string) => value === '' || isNotThrowing(() => JSON5.stringify(JSON.parse(value))),
|
||||
message: 'Provided JSON is not valid.',
|
||||
message: t('tools.json-to-javascript.texts.message-provided-json-is-not-valid'),
|
||||
},
|
||||
];
|
||||
</script>
|
||||
@@ -18,16 +21,16 @@ const rules: UseValidationRule<string>[] = [
|
||||
<template>
|
||||
<div style="flex: 0 0 100%">
|
||||
<div style="margin: 0 auto; max-width: 600px" 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.json-to-javascript.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 JSON"
|
||||
input-placeholder="Paste your JSON here..."
|
||||
output-label="JavaScript Object from your JSON"
|
||||
:input-label="t('tools.json-to-javascript.texts.input-label-your-json')"
|
||||
:input-placeholder="t('tools.json-to-javascript.texts.input-placeholder-paste-your-json-here')"
|
||||
:output-label="t('tools.json-to-javascript.texts.output-label-javascript-object-from-your-json')"
|
||||
output-language="javascript"
|
||||
:input-validation-rules="rules"
|
||||
:transformer="transformer"
|
||||
|
||||
Reference in new issue
Block a user