Hi rodionmoiseev,
in the user guide you have this example:
Messages_en.properties
com.example.gui.window.title = Hello, {0}!
com.example.gui.window.buttons.ok = OK
com.example.gui.window.buttons.cancel = Cancel
Messages_ru.properties
com.example.gui.window.title = Привет, {0}!
com.example.gui.window.buttons.ok = Да
com.example.gui.window.buttons.cancel = Отмена
How can i do this to result to this:
@target(ElementType.METHOD)
@retention(RetentionPolicy.RUNTIME)
public @interface PropertyKey {
String key();
String defaultValue();
String value();
}
package com.example.gui;
public interface Window {
@en("Hello, {0}!")
@ru("Привет, {0}!")
@PropertyKey(key="com.example.gui.window.title", defaultValue="Hello, {0}!")
String title(String userName);
@en("OK")
@ru("Да")
@PropertyKey(key="com.example.gui.window.buttons.ok", defaultValue="OK")
String ok();
@en("Cancel")
@ru("")
@PropertyKey(key="com.example.gui.window.buttons.cancel", defaultValue="Cancel")
String cancel();
}
Window msg = C10N.get(Window.class);
//get message
String ok = msg.ok();
//get message with parameter
String title = msg.title("James");
Thanks in advance.
Cheers
astrapi69