Skip to content

Commit

Permalink
Merge pull request scelis#249 from scelis/feature/jruby-documentation
Browse files Browse the repository at this point in the history
Add documentation for Android and jruby
  • Loading branch information
scelis authored May 30, 2018
2 parents 04cb7f6 + 2878050 commit 9345cdf
Showing 1 changed file with 42 additions and 3 deletions.
45 changes: 42 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ Now, whenever you build your application, Xcode will automatically invoke Twine

### Android Studio/Gradle

Add the following task at the top level in app/build.gradle:
#### Standard

Add the following code to `app/build.gradle`:

```
task generateLocalizations {
String script = 'if hash twine 2>/dev/null; then twine generate-localization-file twine.txt ./src/main/res/values/generated_strings.xml; fi'
Expand All @@ -183,10 +186,46 @@ task generateLocalizations {
args '-c', script
}
}
preBuild {
dependsOn generateLocalizations
}
```

#### Using [jruby](http://jruby.org)

With this approach, developers do not need to manually install ruby, gem, or twine.

Add the following code to `app/build.gradle`:

```
buildscript {
repositories { jcenter() }
Now every time you build your app the localization files are generated from the Twine file.
dependencies {
/* NOTE: Set your prefered version of jruby here. */
classpath "com.github.jruby-gradle:jruby-gradle-plugin:1.5.0"
}
}
apply plugin: 'com.github.jruby-gradle.base'
dependencies {
/* NOTE: Set your prefered version of twine here. */
jrubyExec 'rubygems:twine:1.0.3'
}
task generateLocalizations (type: JRubyExec) {
dependsOn jrubyPrepare
jrubyArgs '-S'
script "twine"
scriptArgs 'generate-localization-file', 'twine.txt', './src/main/res/values/generated_strings.xml'
}
preBuild {
dependsOn generateLocalizations
}
```

## User Interface

Expand Down Expand Up @@ -224,4 +263,4 @@ Many thanks to all of the contributors to the Twine project, including:
[djangopo]: https://docs.djangoproject.com/en/dev/topics/i18n/translation/
[tizen]: https://developer.tizen.org/documentation/articles/localization
[flash]: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/resources/IResourceManager.html#getString()
[printf]: https://en.wikipedia.org/wiki/Printf_format_string
[printf]: https://en.wikipedia.org/wiki/Printf_format_string

0 comments on commit 9345cdf

Please sign in to comment.