https://github.com/ghost-chu/crowdinota
A vanilla Java library that adapt the Crowdin Over-The-Air Content Delivery with cache and custom language mapping support.
https://github.com/ghost-chu/crowdinota
crowdin crowdin-api java library translation
Last synced: 5 months ago
JSON representation
A vanilla Java library that adapt the Crowdin Over-The-Air Content Delivery with cache and custom language mapping support.
- Host: GitHub
- URL: https://github.com/ghost-chu/crowdinota
- Owner: Ghost-chu
- License: mit
- Created: 2022-12-11T12:14:57.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-01-13T14:09:22.000Z (over 2 years ago)
- Last Synced: 2025-03-30T10:25:06.812Z (6 months ago)
- Topics: crowdin, crowdin-api, java, library, translation
- Language: Java
- Homepage:
- Size: 45.9 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```java
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.
```xml
com.ghostchu.crowdin
crowdinota
1.0.3```
## Example Project
[QuickShop-Hikari](https://github.com/Ghost-chu/QuickShop-Hikari/blob/5690651eecfd877e442a7a8f958a6ef896e8edb1/quickshop-bukkit/src/main/java/com/ghostchu/quickshop/localization/text/SimpleTextManager.java#L109) using CrowdinOTA to process the Crowdin distribution.