Skip to content

How to obtain a registry of consulted keys #1646

Discussion options

You must be logged in to vote

Ok so, after some code inspection, I realized that there's a postTranslation hook that can be used for this purpose. From the call of it, I figured that it's interface is that it receives two arguments: the translated value and the key used to fetch it, and needs to return the translation.

I think it’s a cool feature, that I couldn't find anywhere in the documentation really, and could be nice to add it there!

Dummy example of my setup that allows me to log every computed key:

export default new VueI18n({
  locale: process.env.VUE_APP_I18N_LOCALE || 'es',
  fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || 'es',
  messages: loadLocaleMessages(),
  postTranslation: (translatedValue,

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by auirarrazaval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant