Giter VIP home page Giter VIP logo

crowdinota's Introduction

CrowdinOTA

A vanilla Java library that adapt the Crowdin Over-The-Air Content Delivery with cache and custom language mapping support.

Features

  • Translation cache management.
  • Multiple files support.
  • Parallel files downloading.

Usage

public class Test {
    public static void main(String[] args) throws OTAException {
        File myCacheFolder = new File("my-cache");
        String distributionUrl = "https://distributions.crowdin.net/847569d13d22ee803f1cfa7xrm4";
        String crowdinFilePath = "/hikari/quickshop-bukkit/src/main/resources/lang/example.yml";
        CrowdinOTA crowdinOTA = new CrowdinOTA(distributionUrl, myCacheFolder);
        // I/O blocking operation, when you create a OTAFileInstance, it will download all translations
        OTAFileInstance fileInstance = crowdinOTA.getOtaInstance().getFileInstance(crowdinFilePath);
        // Now get your translations!
        System.out.println(fileInstance.getLocaleContentByCrowdinCode("zh-CN"));
        System.out.println(fileInstance.getLocaleContentByCustomCode("locale", "uk-UA"));
        // Or get all available translations!
        fileInstance.getAvailableLocales();
    }
}

Caching

CrowdinOTA will cache all translations in your cache folder, and it will check the cache timestamp, if the cache file is expired, it will download the new translation file from Crowdin.

CrowdinOTA also will store the cache file's SHA-1 for validating.

Maven

We're on Maven Central.

<dependency>
    <groupId>com.ghostchu.crowdin</groupId>
    <artifactId>crowdinota</artifactId>
    <version>1.0.3</version>
</dependency>

Example Project

QuickShop-Hikari using CrowdinOTA to process the Crowdin distribution.

crowdinota's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.