【问题标题】:How to translate items in a String Array? [duplicate]如何翻译字符串数组中的项目? [复制]
【发布时间】:2016-01-05 13:04:39
【问题描述】:

我有一些字符串数组和其中的许多字符串项,我无法使用翻译编辑器进行翻译。

<string-array name="miocene_infos_list">
    <item>The Miocene era was mostly characterized by arrival of a bizarre array of mammalian megafauna. Astrapotherium was a
        hooved ungulate that looked like a cross between an elephant, a tapir and a rhinoceros. It was a distance relative
        of horse. It had short, prehensile trunk and powerful tusks. It\'s hind limbs were significantly weaker than the fore limbs.
        The nostrils of Astrapotherium were also set unusually high which shows that this prehistoric herbivore may have adapted
        partly amphibious lifestyle, like a modern hippopotamus. The Greek meaning for Astrapotherium was \' Lighting Beast \' which
        is inappropriate for such an animal that might have been a slow plant eater.</item>

    <item>Barbourofelis was the only member of its Sabre Tooth Cats breed to colonize late Miocene North America. This megafauna
        mammal possessed some of the largest canines of any saber toothed cat. This cat was heavily muscled and was big as the modern
        Lion. These cats might have walked in a Bear like fashion.</item>

    <item>The largest prehistoric dog that ever lived, Epicyon was a true \'Canid\' and belonged to the same speiceis as wolves,
        hyenas and modern dogs. Some of the largest species of Epicyon weighed more than a full grown human. I had unusually powerful
        jaws and teeth. Due to this reason, it\'s head looked more like that of a big cat than that of a dog or wolf. It may have
        hunted alone or in packs and also might have fed on dead carcasses. All of the species of Epicyon were discovered in
        western North America</item>

    <item>Brygmophyseter was an opportunistic predator, chomping down on penguins, sharks, seals and even other prehistoric whales.
        was pretty large in size. Brygmophyseter would also have lived in social groups called pods, and probably hunted in packs,
        like modern Orcas. Brygmophyseter was likely among the apex predators of its time. It teeth were 14 cm long. It may have
        also possessed Sonar capabilities to detect underwater preys. Its large head might have been used to ram opponents during
        fights.</item>

    <item>
        Megalodon was the largest prehistoric shark and also the largest marine predator in the history of planet. It outweighs ancient reptiles like
        Liopleurodon and Kronosaurus. It may have looked like an over sized Great White Shark. It fed on dolphins, squids, fish, and even giant turtles.
        Megalodon may even have attacked the giant whale Leviathan. Megalodon\'s biting power was very large and delivered 1.8 tons of force. This amount of
        force is enough to cursh the skull of a prehistoric whale as easy as a a grape. The teeth of this prehistoric shark were over half a foot long,
        serrated, and heart-shaped. No wonder why it is named Big Tooth. However there is no evidence on how this enormous creature was vanished off from
        the face of Earth. What a wonder it is.
    </item>
</string-array>

这些项目不会出现在翻译编辑器窗口中。那么我该如何翻译它们呢?有没有其他办法?

【问题讨论】:

  • 您在不同的values文件夹中提供不同的资源文件。

标签: android arrays xml translation


【解决方案1】:

在 res 中创建不同的文件夹结构 像 价值观 价值-FR 价值观-sv 为您要支持的语言创建如上所述的值文件夹。 将 strings.xml 放在每个文件夹中,并带有该特定语言的值。

现在,只要您在 xml 中使用它们,就可以将它们作为 @string/string_name 访问。 从 java 访问它们时使用 context.getString(R.string.string_name)。

会工作。希望对您有所帮助。

【讨论】:

    【解决方案2】:
    res/values/array.xml
    res/values-fr/array.xml
    res/values-ja/array.xml
    

    根据this

    【讨论】:

    • 这个答案意味着该数组在您的 strings.xml 文件的任何翻译版本中都将具有相同的名称。例如,在默认目录下的strings.xml中: englishfrench...
    • 这个答案意味着该数组在您的 strings.xml 文件的任何翻译版本中都将具有相同的名称。例如,在默认目录下的 strings.xml 中:englishfrench...。现在在文件中:es/strings.xml 位于目录中,用于翻译例如西班牙语:inglésfrancés...
    • 如果您尚未创建包含带有西班牙语版本的字符串的 strings.xml 的西班牙语目录,则可以在翻译字符串术语时自动创建它,例如:"NAME: " 使用翻译菜单。为了保持数组及其翻译版本的一致性,请将它们全部复制到电子表格程序中,例如Excel,每个数组占据一列,并且每一行都将匹配正确的翻译版本。当您修改或添加或删除一行时,更改将影响正确位置的所有数组。干杯。
    猜你喜欢
    • 1970-01-01
    • 2014-09-04
    • 1970-01-01
    • 2021-12-23
    • 1970-01-01
    • 2015-01-04
    • 1970-01-01
    • 2013-01-09
    • 2020-12-16
    相关资源
    最近更新 更多