1
0
mirror of https://github.com/nitu2003/T18n synced 2024-11-21 15:18:47 +00:00
轻量级开源本地化库 https://github.com/nitu2003/T18n
Go to file
Taskeren bf55d38a7b 修改方法位置
1. 将操作方法移动到T18n中
2. 添加 README
2019-10-01 19:17:50 +08:00
.github/workflows 添加CI支持 2019-08-30 11:35:35 +08:00
gradle/wrapper v1.0 2019-06-25 21:29:10 +08:00
src/main/java/cn/glycol/t18n 修改方法位置 2019-10-01 19:17:50 +08:00
.gitignore 调整部分方法 2019-08-30 12:17:48 +08:00
build.gradle v1.0 2019-06-25 21:29:10 +08:00
gradlew 给予Gradlew执行权限 2019-08-30 12:19:25 +08:00
gradlew.bat v1.0 2019-06-25 21:29:10 +08:00
README.md 修改方法位置 2019-10-01 19:17:50 +08:00
settings.gradle v1.0 2019-06-25 21:29:10 +08:00

Taskeren's Internationalization

A lightweight, powerful I18n tool for Java.

Get T18n

You can get this project in Jitpack with Maven, Gradle and so on.

Maven

  1. Import the Jitpack source.
	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>
  1. Add the denpendency.
	<dependency>
	    <groupId>com.github.nitu2003</groupId>
	    <artifactId>T18n</artifactId>
	    <version>1.5</version>
	</dependency>

Gradle

  1. Import the Jitpack source.
    repositories {
		...
		maven { url 'https://jitpack.io' }
	}
  1. Add the dependency.
	dependencies {
	    implementation 'com.github.nitu2003:T18n:1.5'
	}

For else

Dev with T18n

  1. Get the Language Map.
// from file
LanguageMapBuilder.fromFile(new File("res/i18n/en_us.lang"));
// from jar resource
LanguageMapBuilder.fromJarResource("res/i18n/en_us.lang");
// from online content (Deprecated)
LanguageMapBuilder.fromURL("https://example.com/i18n/en.lang");
  1. Push it to the I18n.
// reset the I18n and push it
T18n.set(theMap);
// add the new to the old
T18n.add(theMap);
  1. Use it in the project en.lang
HelloToUser=Hello %s.

app.java

System.out.println(I18n.format("HelloToUser", "Taskeren")); // It should be "Hello Taskeren"