JSON-LD multilingual support explained: How to describe multiple languages at the same time

Spread the love

When implementing multilingual support in JSON-LD, you can use various methods to describe content in multiple languages simultaneously. This article details the multilingual use of JSON-LD, which is suitable for scenarios where you need to provide multiple language versions of the same property, such as multilingual websites or internationalized applications.

Multilingual support is a critical requirement in web application development, especially for international websites or applications. JSON-LD (JSON for Linked Data), a structured data markup language, provides multiple ways to achieve multilingual support. This article details how to describe content in multiple languages simultaneously in JSON-LD, helping developers better implement multilingual structured data.

Why do we need multi-language support?

The primary purpose of multilingual support is to provide a consistent and accurate experience for users of different languages. For JSON-LD structured data, multilingual support can help:

  1. Improve search engine visibility : Search engines can select the appropriate version of content based on the user’s language preference.
  2. Support for voice search and AI assistants : Voice assistants (such as Google Assistant and Siri) can extract multilingual content and directly answer user queries.
  3. Enhance user experience : Provide users with content in their native language to increase user satisfaction and engagement.

Implementation of JSON-LD multilingual support

In JSON-LD, multilingual support can be achieved in the following ways:

1. Use @languagekeywords

@languageKeywords are used to specify the language of the text. You can provide multiple language versions of the same attribute in the form of an array.

Example: Using @languagethe keyword

{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": [
    {
      "@value": "示例产品",
      "@language": "zh"
    },
    {
      "@value": "Example Product",
      "@language": "en"
    }
  ],
  "description": [
    {
      "@value": "这是一个示例产品的描述。",
      "@language": "zh"
    },
    {
      "@value": "This is a description of the example product.",
      "@language": "en"
    }
  ]
}

illustrate:

  • Use arrays to provide multiple language versions for namethe and properties.description
  • Each language version @valuespecifies the text content through and @languagethe language code through (for example, zhfor Chinese, enfor English).

2. Use LanguageType

Schema.org provides Languagethe type, which can be used to describe multilingual content. By nesting Languagethe type, you can provide multiple language versions for the same property.

Example: Using Languagethe type

{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": {
    "@type": "Language",
    "zh": "示例产品",
    "en": "Example Product"
  },
  "description": {
    "@type": "Language",
    "zh": "这是一个示例产品的描述。",
    "en": "This is a description of the example product."
  }
}

illustrate:

  • Use the and properties of Languagetype to provide versions in multiple languages.namedescription
  • Each language version is specified directly by a language code (for example zhen).

3. Use ItemListType

If you need to provide multiple language versions of the same property, and each language version requires a more complex structure (for example, to contain additional metadata), you can use ItemListthe type.

Example: Using ItemListthe type

{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": {
    "@type": "ItemList",
    "itemListElement": [
      {
        "@type": "Language",
        "name": "示例产品",
        "language": "zh"
      },
      {
        "@type": "Language",
        "name": "Example Product",
        "language": "en"
      }
    ]
  },
  "description": {
    "@type": "ItemList",
    "itemListElement": [
      {
        "@type": "Language",
        "name": "这是一个示例产品的描述。",
        "language": "zh"
      },
      {
        "@type": "Language",
        "name": "This is a description of the example product.",
        "language": "en"
      }
    ]
  }
}

illustrate:

  • Use the and properties of ItemListtype to provide versions in multiple languages.namedescription
  • Each language version Languageis described by a type, which contains nameand languageproperties.

Notes on multi-language support

When implementing JSON-LD multilingual support, keep in mind the following points:

  • Language Code : Use standard language codes (e.g. zhfor Chinese, enfor English). If you need to distinguish regional variants, you can use extended language codes (e.g. zh-CNfor Simplified Chinese, zh-TWfor Traditional Chinese).
  • Content consistency : Ensure that the content in each language version is semantically consistent to avoid translation errors or omissions.
  • Search engine support : Search engines like Google will choose the appropriate version of your content based on the user’s language preference. Ensure that the JSON-LD data is consistent with the HTML content of the page.
  • Testing and validation : Use Google’s Rich Results Testing Tool to verify that JSON-LD is implemented correctly. This ensures that multilingual content can be correctly parsed and displayed by search engines.

Summarize

When implementing multilingual support in JSON-LD, you can describe content in multiple languages simultaneously in the following ways:

  1. Use @languagethe keyword : Provide multiple language versions of the same attribute in an array.
  2. Use Languagetype : to specify multiple language versions of a property directly.
  3. Use ItemListType : to provide multiple language versions for properties that require complex structures.

By using these methods properly, you can provide clear and accurate structured data for multilingual websites or international applications, thereby improving search engine visibility and user experience.

appendix :

The resources on this site come from the Internet and are used for learning and research by Internet enthusiasts. If your rights are accidentally infringed, please contact the webmaster in time to handle and delete them. Please understand!
IT Resource Hub » JSON-LD multilingual support explained: How to describe multiple languages at the same time

Leave a Reply

Provide the best collection of resources

View Now Learn More