Skip to content

Is there a way to translate a page after api responded and page is fully rendered? #19

Closed Answered by i7eo
greatmaxix asked this question in Q&A
Discussion options

You must be logged in to vote

This library supports dynamic translation. Because Google translate sdk provides class name notranslate to avoid translation.
You can try as follows:

<template>
    <div id="app" class="notranslate" ref="app">
        <button @click="handleAsyncTranslate">Async Test</button>
        <v-google-translate />
    </div>
</template>

<script>
export default {
  name: "App",
  methods: {
    handleAsyncTranslate() {
      const appEl = this.$refs.app
      if (appEl.classList.contains("notranslate")) {
        appEl.classList.remove("notranslate");
      }
    }
  },
};
</script>

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@greatmaxix
Comment options

@i7eo
Comment options

i7eo Aug 12, 2022
Maintainer

Answer selected by greatmaxix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants