轻量级开源本地化库 https://github.com/nitu2003/T18n
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Taskeren bf55d38a7b 修改方法位置 9 months ago
.github/workflows 添加CI支持 10 months ago
gradle/wrapper v1.0 1 year ago
src/main/java/cn/glycol/t18n 修改方法位置 9 months ago
.gitignore 调整部分方法 10 months ago
README.md 修改方法位置 9 months ago
build.gradle v1.0 1 year ago
gradlew v1.0 1 year ago
gradlew.bat v1.0 1 year ago
settings.gradle v1.0 1 year ago

README.md

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"