Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

How to add "Chinese/Traditional" to Yup?


I want to use Chinese/Traditional as Yup default language?
I found some modules about
<a>
https://github.com/loicmahieu/yup-locales#readme
</a>
Are your theme support?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


Hi Anthony,

Thank you for your question.

Unfortunately, at the moment we do not use yup-locales dependency in our theme, we are handling all translations using vue-i18n. We checked this dependency and it seems like it is a quite useful extension to translate yup default error messages, we will consider adding this extension in the next releases.

Regards,
Lauris Stepanovs,
Keenthemes Support Team



Can you show me how to use vue-i18n to localize Yup with Chinese Traditional?



Hi,

Firstly, you will need to register your translation keys in file src/core/plugins/i18n.ts. You can follow our i18n docs: https://preview.keenthemes.com/metronic8/vue/docs/#/internationalization

Then in component you can import translation functions with useI18n.

const { t } = useI18n();


And in your yup object instead of hardcoded messages you can use translation key.

Yup.object({
accountType: Yup.string().required(t("account_required_message")).label(t("account_label")),
}),


Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(