使用语言编辑器添加已翻译的内容
您可以查看和更新模板中的任何语言,无论是您自己创建的翻译还是下载时附带的翻译。
在创建或更新翻译时,您需要将已翻译的内容添加到文本块:
查找要翻译的内容
内容类型
查找要翻译的内容
您可以使用语言编辑器来查找模板中您想翻译的文本内容。
内容类型
您可能希望翻译三种基本类型的内容:
纯文本
HTML
Liquid
您可以通过在文本字段中输入翻译来翻译每段文本。
您不必翻译模板中的每个字段。您的更改会自动保存,并且您可以随时停止。如果要进行更改,您可以访问任何现有翻译。
如果某一字段没有翻译,则将使用该模板的默认语言。
您可以直接翻译纯文本,但在翻译包含 HTML 或 Liquid 的文本块时,您需要格外的谨慎。
翻译纯文本
对于您在线商店中的大多数文本,您无需使用 HTML 或 Liquid。当您输入纯文本块的翻译时,您只需将文本替换为使用其他语言的等效文本即可。
包含 HTML 的文本块
如果文本块包含 HTML,那么您会看到成对的尖角括号 ( <
>
) 围绕单词或短语。
必须了解在要翻译的块中使用 HTML 的方式。虽然您需要将大部分内容都保留为英语原文,但您可能需要翻译 HTML 标签内的一些英语单词。
通常使用包含 HTML 的文本块,原因如下:
创建指向在线商店其他部分或指向其他网站的链接
为文本添加格式。
翻译 HTML 链接名称
HTML 链接包含在以 <a href=
开头,以 </a>
结尾的标签中。
您只能翻译链接的名称,而不能翻译其他组件。链接名称是客户将看到的唯一链接部分。
Continue browsing <a href="/collections/all">here</a>.
在此示例中,您将使用合适的翻译替换单词 Continue(继续)、browsing(浏览)和 here(此处)。
切勿翻译链接中的目标地址(也称为目标)。目标地址是客户点击链接时将转到的位置。它始终显示在引号中并指向特定网址。在示例链接中,目标地址为 /collections/all
。
翻译使用 HTML 设置样式的文本
HTML 有时用于强调单词或短语、为其提供其他样式,或者用于显示符号。您只能翻译使用 HTML 设置样式的单词,而不能翻译代码或标签本身。请查看示例,确保您了解要翻译的内容以及应保留不变的内容。
HTML 样式设置示例
在以下示例中,<strong>
标签用于以粗体显示文本:
<strong>On Sale</strong>
在这种情况下,只需翻译单词 "On Sale"。
在以下示例中,HTML 代码 ←
和 →
用于生成左右箭头符号:
← Previous Product
Next Product →
在这里,您只需翻译词组 Previous Product(上一个产品)和 Next Product(下一个产品)。
在以下示例中,HTML <strong>
标签用于加粗显示文件名 collection-sidebar.liquid。
Add a type to your products for this list to build itself. All lists are created in <strong>collection-sidebar.liquid</strong>
此处的文件名是一个 Liquid 模板文件。只有在需要匹配文件名本身时才应翻译文件名。例如,如果您已创建自己的文件,则可能需要更改 HTML 中的文件名。
切勿翻译 HTML 标签或符号代码。它们由浏览器使用,客户无法看到。
包含 Liquid 的文本块
切勿翻译 Liquid 标签、对象或筛选器。
Liquid 是一种模板语言,可控制网站在不同环境中的外观。Liquid 内容始终包含在以下某组符号之中:
{{
and}}
{%
and%}
{%-
and-%}
例如:
Posted on {{ date }}
在此示例中,您只需翻译 Liquid 周围的文本,而无需翻译 {{ date }}
。
以下是使用纯文本、HTML 和 Liquid 的组合的文本字段示例:
<strong>{{ author }}</strong> on {{ date }}
虽然此示例可能看起来很复杂,但您需要翻译的唯一部分只是单词 on。
Shopify商户官网原文详情:
Using the language editor to add translated content
You can review and update any language in your theme, whether you created the translation yourself or it came with the download.
You'll need to add translated content to text blocks when you're creating or updating translations:
Find the content that you want to translate
Types of content
Find the content that you want to translate
You can use the language editor to find the text content in your theme that you want to translate.
Types of content
There are three basic types of content that you might want to translate:
Plain text
HTML
Liquid
You can translate each piece of text by entering translations into the text fields.
You don't have to translate every field in your theme. Your changes are saved automatically and you can stop at any time. You can access any existing translation if you want to make changes.
If you leave a field without a translation, then the default language for the theme is used.
You can translate plain text directly, but you'll need to take extra care when translating text blocks containing HTML or Liquid.
Translate plain text
For most of the text on your online store, you don't need to use HTML or Liquid. When you enter a translation of a plain text block, all you have to do is replace the text with its equivalent in the other language.
Text blocks that contain HTML
If a text block contains HTML, then you'll see pairs of angled brackets (
<
>
) surrounding words or phrases.It's important to understand how the HTML is being used in the block that you're translating. Although you'll need to leave most of the content in the original English, there might be some English words inside of the HTML tags that you'll want to translate.
Text blocks that contain HTML are typically used for the following reasons:
creating links to another part of your online store or to a different website
adding formatting to text.
Translate HTML link names
An HTML link is surrounded in tags that start with
<a href=
and end with</a>
.You must translate only the name of the link, and not its other components. The link name is the only part of the link that your customers will see.
Continue browsing <a href="/collections/all">here</a>.In this example, you'd replace the words Continue, browsing, and here, with a suitable translation.
Never translate the destination address (also known as the target) in a link. The destination address is where a customer goes when they click the link. It's always shown in quotation marks and points to a specific web address. In the example link, the destination address is
/collections/all
.Translate text styled with HTML
HTML is sometimes used to give emphasis or additional styling to words or phrases, or to display symbols. You must translate only the words that are being styled by the HTML, and not the codes or tags themselves. Take a look at the examples to make sure that you understand what to translate and what you should leave unchanged.
HTML styling examples
In the following example, the
<strong>
tags are used to display text in bold:<strong>On Sale</strong>In this case, you'd translate only the words On Sale.
In the following example, HTML codes
←
and→
are used to generate left and right arrow symbols:← Previous ProductNext Product →Here, you'd translate only the phrases Previous Product and Next Product.
In the following example, HTML
<strong>
tags are used to display the file name collection-sidebar.liquid in bold.Add a type to your products for this list to build itself. All lists are created in <strong>collection-sidebar.liquid</strong>The file name here is a Liquid template file. You should translate the file name only if it's necessary to match the name of the file itself. For example, if you have created your own files, then you might need to change the file name in the HTML.
Never translate HTML tags or symbol codes. These are used by your browser, and are not seen by your customers.
Text blocks that contain Liquid
Never translate Liquid tags, objects, or filters.
Liquid is the templating language that controls the appearance of your website in different contexts. Liquid content is always wrapped in one of the following sets of symbols:
{{
and}}
{%
and%}
{%-
and-%}
For example:
Posted on {{ date }}In this example, you would translate only the text around the Liquid, and not
{{ date }}
.Here's an example of a text field that uses a combination of plain text, HTML, and Liquid:
<strong>{{ author }}</strong> on {{ date }}Although this example might look complex, the only part that you'd need to translate is the word on.
文章内容来源:Shopify商户官方网站