集成指南

翻译 Nuxt 应用程序

1. 创建账户

要开始,请按照以下步骤操作::

  • app.globalseo.ai.
  • 创建一个项目并选择您希望将网站翻译成的语言。.
  • 点击: :"“保存并集成”"
  • 现在您应该会看到一个弹出窗口,其中显示两个HTML代码片段。请按照以下步骤将代码集成到您的网站中。 .

如何将HTML脚本添加到您的网站::

Step 1: Open the Layout File for Custom Head Code

To add custom head code in Nuxt.js, you first need to open the layout file where you want to include the custom head configuration. This file is typically located in the layouts directory of your Nuxt project.

  1. Navigate to the layouts directory in your Nuxt project.
  2. Open the default.vue file (or any other layout file you wish to modify).

Your file structure should look something like this:

project-root/
├── layouts/
│   ├── default.vue
│   └── another-layout.vue

In the default.vue file, you can now add your custom head code.

Note:

When adding the following code to the default.vue file, make sure to adjust the placeholder values such as YOUR_API_KEY, YOUR_WEBSITES_ORIGINAL_LANGUAGE, and LANGUAGES_TO_TRANSLATE_TO to match your specific requirements:

<template>
  <div>
    <!-- Your existing template code -->
  </div>
</template>

<script>
export default {
  head() {
    return {
      link: [
        {
          rel: 'stylesheet',
          href: 'https://unpkg.com/weploy-translate/dist/weploy-translate.css'
        }
      ],
      script: [
        {
          src: 'https://unpkg.com/weploy-translate/dist/weploy-translate.js',
          'data-globalseo-key': 'YOUR_API_KEY',
          'data-use-browser-language': 'true',
          'data-original-language': 'YOUR_WEBSITES_ORIGINAL_LANGUAGE',
          'data-allowed-languages': 'LANGUAGES_TO_TRANSLATE_TO',
          'data-exclude-classes': ''
        }
      ]
    }
  }
}
</script>
Plus Icon
集成至
Nuxt

由...构建

开源

网站

nuxt.com

类别

框架

欢迎来到AI网站本地化的未来

在5分钟内开始为您的网站翻译。注册并免费获得2000个翻译词汇。 .

开始使用