Improved I18N support:

* GamePageData now includes the selected language's code.
* Added support for multiple fetches in one call to the Translator
service.
This commit is contained in:
Emmanuel BENOîT 2012-04-05 11:25:08 +02:00
parent c7949e41cc
commit 9a7bc03171
9 changed files with 316 additions and 50 deletions
legacyworlds-server-interfaces/src/main/java/com/deepclone/lw/interfaces/i18n

View file

@ -1,6 +1,8 @@
package com.deepclone.lw.interfaces.i18n;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
@ -8,12 +10,12 @@ import java.util.Set;
/**
* Translator service interface
*
* <p>
* This interface defines the methods available on the Translator service. One such service should
* be present on all nodes. All Translator service instances are managed by the I18NManager service,
* which is shared between nodes and notifies Translator instances of database updates.
*
* @author tseeker
*
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
*/
public interface Translator
{
@ -62,4 +64,28 @@ public interface Translator
*/
public String translate( String language , String string )
throws UnknownStringException , UnknownLanguageException;
/**
* Translate multiple strings based on their identifiers
*
* <p>
* This method must be implemented to allow "en masse" string translations. It will fetch the
* translations in a given language for an arbitrary quantity of string identifiers, returning
* the results as a map of identifiers to translations.
*
* @param language
* the identifier of the language to translate to
* @param strings
* a collection of string identifiers
*
* @return a map associating string identifiers to translations
*
* @throws UnknownStringException
* if one of the string identifiers does not match a string
* @throws UnknownLanguageException
* if the language does not exist or is not supported
*/
public Map< String , String > translate( String language , Collection< String > strings )
throws UnknownStringException , UnknownLanguageException;
}