Skip to content

Commit 25aa563

Browse files
authored
Revise README for clarity and structure
Updated the README to enhance clarity and organization, including a revised quick start section and improved module descriptions.
1 parent 9d7263e commit 25aa563

1 file changed

Lines changed: 28 additions & 57 deletions

File tree

README.md

Lines changed: 28 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,40 @@
11
# Kotonoha (言の葉)
2-
3-
A localization framework for projects using [Adventure](https://github.com/KyoriPowered/adventure).
4-
5-
Kotonoha allows defining multilingual messages as methods in Java interfaces.
6-
7-
## Modules
8-
9-
| Module | Description |
10-
|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
11-
| **kotonoha-annotations** | Common annotations shared across modules. |
12-
| **kotonoha-resourcebundle-generator-processor** | An annotation processor that generates `.properties` resource bundles from annotated interfaces and includes them in the resulting artifact. |
13-
| **kotonoha-message** | Core module providing reflection-based proxies that create `TranslatableComponent` instances from interface method calls. |
14-
| **kotonoha-message-extra-miniplaceholders** | Extension module providing [MiniPlaceholders](https://github.com/MiniPlaceholders) integration. |
15-
| **kotonoha-translator** | A `Translator` module that registers translations from annotated methods. |
16-
17-
### Quick Start (MessageFormat)
18-
19-
Depends on `kotonoha-message` and `kotonoha-translator`.
20-
21-
Define a message interface:
22-
2+
3+
A localization framework for Java projects built on [Adventure](https://github.com/KyoriPowered/adventure).
4+
Define multilingual messages as methods on a plain Java interface.
5+
236
```java
247
public interface ExampleMessages {
25-
26-
// {0} will be replaced by the value of the 'playerName' argument.
27-
@Key("your_plugin.welcome.message")
8+
9+
@Key("example.welcome")
2810
@Message(locale = Locales.EN_US, content = "Welcome, {0}!")
2911
@Message(locale = Locales.JA_JP, content = "ようこそ、{0}!")
3012
Component welcomeMessage(Component playerName);
31-
32-
/*
33-
For MiniMessage:
34-
<player_name> will be replaced by the value of the 'playerName' argument.
35-
@Key("your_plugin.welcome.message")
36-
@Message(locale = Locales.EN_US, content = "Welcome, <player_name>!")
37-
@Message(locale = Locales.EN_US, content = "ようこそ、<player_name>!")
38-
Component welcomeMessage(@Name("player_name") Component playerName);
39-
*/
4013
}
4114
```
42-
43-
Register the translator and create a proxy instance:
44-
15+
4516
```java
46-
// Register translations from the interface.
47-
Key name = Key.key("your_plugin", "messages");
48-
KotonohaTranslationStore<MessageFormat> translator = KotonohaTranslationStore.messageFormat(name);
49-
translator.registerInterface(ExampleMessages.class);
50-
51-
// Add to global source.
52-
GlobalTranslator.translator().addSource(translator);
53-
54-
// Create proxy instance.
17+
KotonohaTranslationStore<MessageFormat> store = KotonohaTranslationStore.messageFormat(name);
18+
store.registerInterface(ExampleMessages.class);
19+
GlobalTranslator.translator().addSource(store);
20+
5521
ExampleMessages messages = KotonohaMessage.createProxy(ExampleMessages.class, FormatTypes.MESSAGE_FORMAT);
56-
57-
// Get the message and send it.
58-
Component result = messages.welcomeMessage(player.name());
59-
audience.sendMessage(result); // Welcome, Notch!!
22+
Componnent message = messages.welcomeMessage(player.displayName());
23+
player.sendMessage(message);
6024
```
61-
62-
For more information on Adventure's localization:
63-
https://docs.papermc.io/adventure/localization/
64-
25+
26+
## Modules
27+
28+
| Module | Description |
29+
| --- | --- |
30+
| `kotonoha-annotations` | Common annotations (`@Key`, `@Message`, `@Name`, etc.) |
31+
| `kotonoha-message` | Proxy factory that builds `TranslatableComponent` from interface calls |
32+
| `kotonoha-translator` | Registers translations from annotated interfaces into Adventure's `TranslationStore` |
33+
| `kotonoha-resourcebundle-generator-processor` | Compile-time processor that generates `.properties` files from annotated interfaces |
34+
| `kotonoha-message-extra-miniplaceholders` | [MiniPlaceholders](https://github.com/MiniPlaceholders/MiniPlaceholders) integration |
35+
6536
## Documentation
66-
67-
Javadocs (Available soon)
68-
69-
GitHub Wiki (Available soon)
37+
38+
[GitHub Wiki](https://github.com/NamiUni/kotonoha/wiki)
39+
40+
[Javadoc](https://javadoc.io/doc/io.github.namiuni)

0 commit comments

Comments
 (0)