JSON-LD multilingual support explained: How to describe multiple languages at the same time
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:
- Improve search engine visibility : Search engines can select the appropriate version of content based on the user’s language preference.
- Support for voice search and AI assistants : Voice assistants (such as Google Assistant and Siri) can extract multilingual content and directly answer user queries.
- 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 @language
keywords
@language
Keywords 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 @language
the 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
name
the and properties.description
- Each language version
@value
specifies the text content through and@language
the language code through (for example,zh
for Chinese,en
for English).
2. Use Language
Type
Schema.org provides Language
the type, which can be used to describe multilingual content. By nesting Language
the type, you can provide multiple language versions for the same property.
Example: Using Language
the 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
Language
type to provide versions in multiple languages.name
description
- Each language version is specified directly by a language code (for example
zh
,en
).
3. Use ItemList
Type
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 ItemList
the type.
Example: Using ItemList
the 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
ItemList
type to provide versions in multiple languages.name
description
- Each language version
Language
is described by a type, which containsname
andlanguage
properties.
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.
zh
for Chinese,en
for English). If you need to distinguish regional variants, you can use extended language codes (e.g.zh-CN
for Simplified Chinese,zh-TW
for 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:
- Use
@language
the keyword : Provide multiple language versions of the same attribute in an array. - Use
Language
type : to specify multiple language versions of a property directly. - Use
ItemList
Type : 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 :
IT Resource Hub » JSON-LD multilingual support explained: How to describe multiple languages at the same time