Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • 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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(