Interface I18nResource
@Path("/i18n")
public interface I18nResource
Resource to translate given keys (optionally including parameters)
-
Method Summary
Modifier and TypeMethodDescriptionGet the current session languagelist()
setLanguage
(SetLanguageRequest request) Set the current session languagetranslateFromParam
(String key, List<String> parameters) Translate the given key and optional parameters (variant with key given as query parameter)translateFromPath
(String key, List<String> parameters) Translate the given key and optional parameters (variant with key given in the path)
-
Method Details
-
list
- Throws:
Exception
-
translateFromPath
@GET @Path("/t/{key}") @Produces("text/plain; charset=UTF-8") String translateFromPath(@PathParam("key") String key, @QueryParam("p") List<String> parameters) throws Exception Translate the given key and optional parameters (variant with key given in the path)- Parameters:
key
- translation keyparameters
- optional parameters- Returns:
- translated string
- Throws:
Exception
-
translateFromParam
@GET @Path("/t") @Produces("text/plain; charset=UTF-8") String translateFromParam(@QueryParam("k") String key, @QueryParam("p") List<String> parameters) throws Exception Translate the given key and optional parameters (variant with key given as query parameter)- Parameters:
key
- translation keyparameters
- optional parameters- Returns:
- translated string
- Throws:
Exception
-
setLanguage
Set the current session language- Parameters:
request
- request to set the current session language- Returns:
- response
- Throws:
Exception
-
getLanguage
Get the current session language- Returns:
- session language
- Throws:
Exception
-