Any tool to convert Android's XML localization to iPhone's .strings file? [closed]

放肆的年华 提交于 2019-12-08 16:17:12

问题


I guess the title is self-explanatory.


回答1:


You can extract localization from Android .xml file then add it to iPhone .string file with last version of TM-database tool. It is easy:

  1. Launch tool
  2. Open source and target Android xml files and import localization to TM
  3. Open .string file and translate it with TM
  4. Save .string file

Please see the detail instruction here




回答2:


I was just looking at this as well. If you just need something to get some of the grunt work done, and you're on OsX already, you can use xsltproc and this simple xsl to get you going

The xsl:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="string">
"<xsl:value-of select="@name"/>"= "<xsl:apply-templates/>"; </xsl:template>
<xsl:template match="resources">
<xsl:apply-templates select="string"/> </xsl:template>
</xsl:stylesheet>   

Save this to a file, transform.xsl or something, then from a shell run the following:

xsltproc transform.xsl your_android_strings.xml > fileforxcode.out

This seemed to generate something that looked right, although you'll probably need to muck with any format strings separately. No matter what, it might save you some work.




回答3:


I use a script here. It converts the already-translated Android localized strings files into iOS Localizable.strings files, accounting for conversions of string placeholders (%1$sbecomes %1$@). Its a short ruby script and is easy to follow. Link it into Xcode as a Run Script at the beginning of your build process.




回答4:


You also have this option if you don't want to preprocess the strings but just drop the android strings.xml file into the iPhone project.




回答5:


This don't really answer your question but you may consider DMLocalizedString for your future iOS+Android project. Currently the source is for iOS only, but I believe that making the Android version is pretty easy.



来源:https://stackoverflow.com/questions/7107299/any-tool-to-convert-androids-xml-localization-to-iphones-strings-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!