Skip to content

Manage the translation of the content of your applications with Mantis!

License

Notifications You must be signed in to change notification settings

N7ghtm4r3/Mantis

Repository files navigation

Mantis

v1.0.0

Manage the translation of the content of your applications with Mantis!

Implementation

Add the JitPack repository to your build file

Gradle

  • Add it in your root build.gradle at the end of repositories

    Gradle (Short)

    repositories {
        ...
        maven { url 'https://jitpack.io' }
        maven { url 'https://repo.clojars.org' }
    }

    Gradle (Kotlin)

    repositories {
        ...
        maven("https://jitpack.io")
        maven("https://repo.clojars.org")
    }
  • Add the dependency

    Gradle (Short)

    dependencies {
        implementation 'com.github.N7ghtm4r3:Mantis:1.0.0'
    }

    Gradle (Kotlin)

    dependencies {
        implementation("com.github.N7ghtm4r3:Mantis:1.0.0")
    }

Maven

  • Add it in your root build.gradle at the end of repositories
<repositories>
  <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>
  • Add the dependency
<dependency>
  <groupId>com.github.N7ghtm4r3</groupId>
  <artifactId>Mantis</artifactId>
  <version>1.0.0</version>
</dependency>

Usage/Examples

Resources file

You must place the resources file, named resource.mantis, in the resources folder of your application:

src
|-- main
    |-- resources
    |   |-- resources.mantis

Content example:

{
    "it": {
      "string_one_key" : "ciao!",
      "string_two_key": "prova questa libreria :)"
    },
    "en": {
      "string_one_key" : "hello!",
      "string_two_key": "try this library :)"
    }
}

Workflow

// current locale en
Mantis mantis = new Mantis(Locale.ENGLISH);
System.out.println(mantis.getResource("string_one_key")); // hello!

// current locale it
Mantis mantisIt = new Mantis(Locale.ITALIAN);
System.out.println(mantisIt.getResource("string_one_key")); // ciao!

// Dynamic translation of any contents
System.out.println(mantis.translate("Hello how are you?")); // Ciao, come stai?

Authors

Support

If you need help using the library or encounter any problems or bugs, please contact us via the following links:

Thank you for your help!

Badges

Twitter

Donations

If you want support project and developer

Crypto Address Network
3H3jyCzcRmnxroHthuXh22GXXSmizin2yp Bitcoin
0x1b45bc41efeb3ed655b078f95086f25fc83345c4 Ethereum

If you want support project and developer with PayPal

Copyright © 2023 Tecknobit