Class MCRLocaleResource

java.lang.Object
org.mycore.frontend.jersey.resources.MCRLocaleResource

@Path("locale") public class MCRLocaleResource extends Object
  • Constructor Details

    • MCRLocaleResource

      public MCRLocaleResource()
  • Method Details

    • init

      @PostConstruct public void init()
    • language

      @GET @Produces("text/plain") @Path("language") public String language()
      Returns the current language in ISO 639 (two character) format.
      Returns:
      current language as plain text
    • languages

      @GET @Produces("application/json;charset=utf-8") @Path("languages") public String languages()
      Returns all available languages of the application. The codes are in ISO 639 (two character) format.
      Returns:
      json array of all languages available
    • translateJSON

      @GET @Produces("application/json;charset=utf-8") @Path("translate/{lang}/{key: .*\\*}") public String translateJSON(@PathParam("lang") String lang, @PathParam("key") String key)
      Translates a set of keys to the given language.
      Parameters:
      lang - desired language
      key - message key ending with an asterisk (e.g. component.classeditor.*)
      Returns:
      json object containing all keys and their corresponding translation
    • translateJSONDefault

      @GET @Produces("application/json;charset=utf-8") @Path("translate/{key: .*\\*}") public String translateJSONDefault(@PathParam("key") String key)
      Translates a set of keys to the current language.
      Parameters:
      key - message key ending with an asterisk (e.g. component.classeditor.*)
      Returns:
      json object containing all keys and their corresponding translation in current language
    • translateText

      @GET @Produces("text/plain") @Path("translate/{lang}/{key: [^\\*]+}") public String translateText(@PathParam("lang") String lang, @PathParam("key") String key)
      Translates a single key to the given language.
      Parameters:
      lang - desired language
      key - the key to translate (e.g. component.classeditor.save.successful)
      Returns:
      translated plain text
    • translateTextDefault

      @GET @Produces("text/plain") @Path("translate/{key: [^\\*]+}") public String translateTextDefault(@PathParam("key") String key)
      Translates a single key to the current language.
      Parameters:
      key - the key to translate (e.g. component.classeditor.save.successful)
      Returns:
      translated plain text