搜索

PythonReactSEOPDF
GitHub Skill

adding-localizable-strings

Adds new human-readable strings that are translated into users' languages.

terraware☆ 11 仓库 Stars1 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Adding Localizable Strings

Instructions

Copy this checklist and check off items as you complete them.

Task Progress:
- [ ] Add the strings to the English strings file.
- [ ] Run `yarn translate` to translate to other languages.
- [ ] Run the full test suite with `./gradlew test`.
Step 1: Add the strings to the English strings file

You will usually want to add strings to src/main/resources/i18n/Messages_en.properties.

Each string may be preceded with a comment line (starting with #). The comment is provided to the translation service and can provide additional context about the string to help produce grammatically-correct translations. This is optional and doesn't need to be provided if the English string is a simple, unambiguous word or phrase.

Add strings in alphabetical order by key. But don't insert a string in between a comment line and the existing string the comment is about. For example, if you see

stringX=Foo
# Comment for string Z
stringZ=Bar

and you are adding stringY, put it above string Z's comment, like

stringX=Foo
stringY=Why
# Comment for string Z
stringZ=Bar

Placeholders should be numbered starting with 0, enclosed in curly braces, like {0}.

Strings are rendered using Java's MessageFormat, which treats single quote characters (') as special. If the English text contains single quotes, you must escape them by doubling them. For example, the word "can't" would need to be can''t in the file.

Stick to ASCII characters for punctuation.

Step 2: Run "yarn translate" to translate to other languages

Only add strings to the English strings file. The strings files for other languages include metadata that you won't be able to generate yourself.

We have an automated translation tool that updates the files for other languages, including adding the right metadata.

Run yarn translate to update the non-English strings files with translations for newly-added and modified English strings.

Step 3: Run the test suite

There are various tests that do sanity checking of the strings files. Run the full test suite to make sure you catch any problems.

If you're adding strings as part of a larger task, there's no need to run the full test suite multiple times; you can wait until you're done with the larger task.

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-03-03
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!