|
文件扩展名 |
.xml |
|
API 扩展 |
properties_xml |
|
导入 |
是 |
|
导出 |
是 |
|
复数形式支持 |
否 |
|
描述支持 |
是 |
Java Properties XML 是 Java Properties 文件的 XML 等效格式。Java Properties 文件的 键 作为 XML 中 条目 元素的属性存在,而值则是嵌套在 条目 标记 内的内联文本 Strings。与标准 Java Properties 文件相比,XML 类型 提供了更高的灵活性,因为您可以向 条目 元素 添加 更多属性。例如,您可以决定仅选取具有 class='translatable' 属性的 键 进行翻译。
代码示例
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <entry key="boolean_key">--- true </entry> <entry key="empty_string_translation"/> <entry key="key_with_description">Check it out!This key has a description!(At least in some formats)</entry> <entry key="key_with_line-break">This translations contains a line-break.</entry> <entry key="nested.deeply.key">Wow, this key is nested even deeper.</entry> <entry key="nested.key">This key is nested inside a namespace.</entry> <entry key="null_translation"/> <entry one="Only one pluralization found." other="Wow, you have %s pluralizations!" zero="You have no pluralization." key="pluralized_key"/> <entry key="sample_collection">--- - first item - second item - third item </entry> <entry key="simple_key">Simple key, simple message, so simple.</entry> <entry key="unverified_key">This translation is not yet verified and waits for it.(In some formats we also export this status)</entry> </properties>