Git Product home page Git Product logo

ios-res-tool's People

Contributors

gloix avatar johnson145 avatar stevekchiu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ios-res-tool's Issues

CDATA section parse error

String from Android :

<string name="android">
         <![CDATA[
           <font color="#999999">(%s)</font>
         ]]>
</string>

After (--export-swift):

"android" = "\n ";

undefined method `gsub!' when trying to convert

Hi. I am trying to use this tool to convert string resources from an existing android project. The very first try resulted in the error described below:

Command executed:
bash-3.2$ ruby ios-res-tool/ios-strings.rb --import-android="/Users/smoky/AndroidstudioProjects/NICEAdminBlue/app/src/main/res" --export-ios=./res

resulted in:
........ (lots of message id's here) string: app_name string: btn_OK string: btn_restting string: info_changeInhibited string: btn_SaveProhibited plurals: upgr_god xml: /Users/smoky/AndroidstudioProjects/NICEAdminBlue/app/src/main/res/values-v11/styles.xml xml: /Users/smoky/AndroidstudioProjects/NICEAdminBlue/app/src/main/res/values-v14/styles.xml xml: /Users/smoky/AndroidstudioProjects/NICEAdminBlue/app/src/main/res/values-v21/styles.xml xml: /Users/smoky/AndroidstudioProjects/NICEAdminBlue/app/src/main/res/values-w820dp/dimens.xml ios-res-tool/ios-strings.rb:408:inexport_ios_string': undefined method gsub!' for nil:NilClass (NoMethodError) from ios-res-tool/ios-strings.rb:425:in block (2 levels) in export_ios'
from ios-res-tool/ios-strings.rb:423:in each' from ios-res-tool/ios-strings.rb:423:in block in export_ios'
from ios-res-tool/ios-strings.rb:420:in open' from ios-res-tool/ios-strings.rb:420:in export_ios'
from ios-res-tool/ios-strings.rb:700:in block (2 levels) in <main>' from ios-res-tool/ios-strings.rb:699:in each'
from ios-res-tool/ios-strings.rb:699:in block in <main>' from ios-res-tool/ios-strings.rb:694:in each'
from ios-res-tool/ios-strings.rb:694:in <main>'

The tool looks very promising to me but I do not have knowledge of ruby yet to be able to fix it

Regards, Peter

Styled android text doesn't work

First of all thanks for the great scripts. It's really simple to use them :).

When using the ios-strings.rb script in our project I encountered issues with strings that included styling with html tags. Only the first element/text element was included in the ios string after the import from android.

Example of a problematic string: <string name="nicebox">Nice<b>box</b></string>. In android I use it via ui_widget.setText(getText(R.string.nicebox)) and it correctly sets the text but on ios when I use it via some_function_to_parse_html(R.string.nicebox^) the output is just Nice the <b>box</b> part gets completely ignored.

I fixed the script so it works for our project here: jakgra@0df360a and can create a pull request if you want ?, but I'm not sure it doesn't break some other use case.

The android documentation describing styled strings embeded in strings.xml files: https://developer.android.com/guide/topics/resources/string-resource.html#StylingWithHTML https://developer.android.com/reference/android/content/Context.html#getText(int) and some examples of usage: https://stackoverflow.com/questions/45647928/what-is-the-difference-between-getstring-and-gettext

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.