Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any tools to convert an Iphone localized string file to a string resources file that can be used in Android? [closed]

I have the localized strings file that is used in the Iphone app that I work on to port to Android. Are there any tools that go through the file taken from the xcode project and build the xml needed to use the strings in android?

As the apple file is a simple key value file is there a tool that converts string in this format

"key"="value"

to this:

<string name="key"> value </string>

This tool should be easy to build but I appreciate any pointers to already working tools.

like image 783
Janusz Avatar asked Jun 29 '10 13:06

Janusz


People also ask

How to use Localizable strings in iOS?

Go to the File menu and choose New > File, then select Strings File from the list of file types and click Next. Give this file the name “Localizable. strings”, then click Create to open it for editing.

How to create Localizable strings file?

Choose File → New → File ..., select Strings File under Resources, and click Next. Name it Localizable, then click on Create.

What is localizable string?

Localizable. strings stores application strings as key-value pairs for each language. Let's create this file for the base language first. Select File → New → File… or just tap Ctrl+N or Cmd+N .

How localization work in iOS?

Ensure your app accepts user-generated text in any language and in multiple languages at once, independent of the user interface language. This allows app content to appear in the user's preferred language and format. SwiftUI makes it easy to create localized apps.


2 Answers

I think you might like this tool :

http://members.home.nl/bas.de.reuver/files/stringsconvert.html

Also this one, but it lacks some features (like converting whitespace in name) :

http://localise.biz/free/converter/ios-to-android

It is free, no need of registration, and you won't need to build your own script!

like image 60
NLemay Avatar answered Sep 21 '22 13:09

NLemay


This is one of the areas where the Unix mindset and toolset comes in handy. I don't know what the iPhone format is like, but if it's what you say, with each value one per line, a simple sed call could do this:

$ cat infile
"key"="value"
"key2"="value2"
$ sed 's/ *"\([^"]*\)" *= *"\([^"]*\)"/<string name="\1">\2<\/string>/' infile
<string name="key">value</string>
<string name="key2">value2</string>
$

I expect sed is available on your OSX install.

like image 44
mbafford Avatar answered Sep 21 '22 13:09

mbafford