tr8n-android-clientsdk

Tr8n SDK for Android

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.tr8nhub
ArtifactId

ArtifactId

android-clientsdk
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

tr8n-android-clientsdk
Tr8n SDK for Android
Project URL

Project URL

https://github.com/tr8n/tr8n_android_clientsdk
Project Organization

Project Organization

Tr8nHub
Source Code Management

Source Code Management

https://github.com/tr8n/tr8n_android_clientsdk

Download android-clientsdk

How to add to project

<!-- https://jarcasting.com/artifacts/com.tr8nhub/android-clientsdk/ -->
<dependency>
    <groupId>com.tr8nhub</groupId>
    <artifactId>android-clientsdk</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.tr8nhub/android-clientsdk/
implementation 'com.tr8nhub:android-clientsdk:0.1.0'
// https://jarcasting.com/artifacts/com.tr8nhub/android-clientsdk/
implementation ("com.tr8nhub:android-clientsdk:0.1.0")
'com.tr8nhub:android-clientsdk:jar:0.1.0'
<dependency org="com.tr8nhub" name="android-clientsdk" rev="0.1.0">
  <artifact name="android-clientsdk" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.tr8nhub', module='android-clientsdk', version='0.1.0')
)
libraryDependencies += "com.tr8nhub" % "android-clientsdk" % "0.1.0"
[com.tr8nhub/android-clientsdk "0.1.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.tr8nhub : core jar 0.1.0

provided (1)

Group / Artifact Type Version
com.google.android : android jar 4.1.1.4

Project Modules

There are no modules declared in this project.

TML for Android

TML for Android provides extensions for translating Android apps.

Installation

If you are using Maven:

Add the following dependency to your pom.xml:

<dependency>
  <groupId>com.translationexchange</groupId>
  <artifactId>tml-android</artifactId>
  <version>0.2.1</version>
</dependency>

If you use Eclipse or IntelliJ IDEs, the dependencies will be automatically installed in your project.

Integration

You now can initialize the SDK using the following code:

Tml.init(YOUR_APP_TOKEN);

TML (Translation Markup Language)

You now can use the translation methods provided by TML. Below are some examples:

Simple labels:

Tml.translate("Hello World");

Labels with dynamic data:

Tml.translate(
  "You have selected {language_name} language", 
  Utils.buildMap(
      "language_name", Tml.getCurrentLanguage().getEnglishName()
  )
);
          
Tml.translate(
  "Number of messages: {count}", 
  Utils.buildMap(
    "count", 5
  )
);

Tml.translate(
  "Hello {user.name}, you are a {user.gender}", 
  Utils.buildMap(
      "user", Utils.buildMap(
                "name", "Michael", 
                "gender", "male"
              )
      )
);

Tml.translate(
  "You have {count||message}", 
  Utils.buildMap(
    "count", 5
  )
);

Tml.translate(
  "{user| He, She} likes this movie.", 
  Utils.buildMap(
    "user", Utils.buildMap(
              "gender", "male"
            )
     )
);
      
Tml.translate(
  "{user} uploaded {count|| photo} to {user| his, her} photo album.", 
  Utils.buildMap(
    "user", Utils.buildMap(
              "object", Utils.buildMap(
                  "name", "Michael", 
                  "gender", "male"
              ),
              "attribute", "name"
        ),
    "count", 1
    )
);

Labels with decorations (using HTML):

Tml.translate(
    "[bold: Adjust fonts] using HTML.", 
    Utils.buildMap("bold", "<strong>{$0}</strong>")
);

Tml.translate(
    "[red: Change color] using HTML.", 
    Utils.buildMap(
        "red", "<font color='red'>{$0}</font>"
    )
);

Tml.translate(
  "Nest [bold]some bold and [italic: italic][/bold] using HTML.", 
  Utils.buildMap(
      "italic", "<i>{$0}</i>", 
      "bold", "<strong>{$0}</strong>"
  )
);

Labels with data and decoration tokens (using SpannableString):

Tml.translateSpannableString(
  "[link: {actor}] uploaded [bold: {count|a document, #count# documents}] to a public folder.", 
  Utils.buildMap(
        "actor", user,
        "count", 10,
        "link", Utils.buildMap("color", "blue"),
        "bold", Utils.buildMap("style", "bold")
    ));
    
Tml.translateSpannableString(
  "[link: {actor}] tagged [link: {target}] in [link: {owner::pos}] photo.", 
  Utils.buildMap(
        "actor", user1,
        "target", user2,
        "owner", user3,
        "link", Utils.buildMap("color", "blue")
    ));

Sample Applications

The best way to get started with Tml is to see it in action. A number of sample applications are available for you to see how the SDK can be integrated and used:

Links

Copyright and license

Copyright (c) 2015 Translation Exchange, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Versions

Version
0.1.0