翻译管理

占位符 (Strings)

文本由 Phrase Language AI 从英语机器翻译而得。

可在多种本地化文件格式中使用的常见占位符格式。

为项目选择正确的占位符格式时:

在您的项目中启用占位符样式

创建或编辑项目时,请在 项目设置<2> 窗口的 占位符<1> 选项卡中指定占位符格式。选择所有必需的格式样式,即可在编辑器和 In-context Editor<4> 中工作时立即看到所有匹配的占位符高亮显示。

占位符转换

占位符转换旨在减少多平台开发中的翻译工作量。如果您正在多个移动平台上进行开发,并希望在平台间共享翻译,且不想为每个平台维护单独的项目,请使用占位符转换。通过应用程序或 API 下载区域时,请使用转换占位符格式选项。此格式选项也可以在 .phrase.yml 配置文件中激活。翻译中的占位符会被转换以匹配特定格式的要求。

占位符转换仅适用于以下本地化文件格式(占位符转换仅限于 Android XML 和 iOS Localizable.strings 字符串格式说明符(cstyle 占位符样式)):

可用于高亮显示的占位符格式:

名称

说明

示例

Rails i18n

Rails i18n 风格占位符

%{count}, %{username}

i18next 嵌套

i18next 嵌套 风格占位符

$t(key1), $t(common.{{referencedKey}})

Gettext Python

Gettext 占位符 (python-format)

%(count)d, %(username)s, %(foo)

C-Style

C-Style 格式,带位置和不带位置的格式

%1$s, %2$d, %d, %@, %1%@, %1$#@file@, %#@file@, %1$i, $%1$.2f, %.0f%, %ld, %c, %hi, %lu

Python Strings

Python 格式 Strings

{}, \{1\}, {name}

.Net C#-Style

.Net C#-Style 格式

{0,10:C}, {0}, {1:hh}

简单消息属性

简单 Java 消息属性

{1}, {count}d, "{brackets}"

Laravel

以冒号开头的 Laravel 占位符

:name, :NAME, :Name

方括号

带有方括号的占位符(BB-Code 样式)

[u]abc[/u], [占位符]

单百分号

带有单个包围百分号的占位符

%abc%

双百分号

带有双百分号的占位符

%%abc%%

Emoji

Emoji 代码

:sob:, :smile:

美元符号样式

带有起始和结束 $ 符号的占位符。

$bc$, $.abc$, $!abc$, $+abc$, $-abc$, $-+.!abc$

NSIS

带有起始 $ 和结束/起始(花)括号的占位符。

${StdUtils.TrimStr}, $(StdUtils.TrimStr), ${String}

Razor 标记

用于突出显示没有代码块的 C# Razor 表达式的占位符

@DateTime.Now, @(DateTime.Now - TimeSpan.FromDays(3))

双花括号

带有开始和结束双花括号的占位符,例如用于 AngularJS。

{{number}}, {{foo.bar}}, {{username}}

Android XLIFF 占位符

带有开始 <xliff:g> 和结束 </xliff:g> 的占位符?例如用于 AndroidXml。

<xliff:g>%1s</xliff:g>,<xliff:g id_"star">★</xliff:g>

OASIS XLIFF 占位符

带有闭合标签 &lt;x id=\"YOUR_ID\"&gt; 的占位符,例如用于 Angular2。

<x id_"id" example="name"/>, <x id="id"/>

Liquid

Liquid 样式占位符

{{count}}, {{username}}

这篇文章有帮助吗?

Sorry about that! In what way was it not helpful?

The article didn’t address my problem.
I couldn’t understand the article.
The feature doesn’t do what I need.
Other reason.

Note that feedback is provided anonymously so we aren't able to reply to questions.
If you'd like to ask a question, submit a request to our Support team.
Thank you for your feedback.