Package com.vaadin.flow.i18n
Class TranslationFileRequestHandler
java.lang.Object
com.vaadin.flow.i18n.TranslationFileRequestHandler
- All Implemented Interfaces:
SessionlessRequestHandler,Serializable
Handles translation file requests. Translation file requests are internal
requests sent by the client-side to retrieve the translations for the
specified language tag. The response contains the translations in JSON
format. The requested language tag is included as a header with the name
X-Vaadin-Retrieved-Locale. The language tag parameter langtag
supports both dash and underscore as separators.
The translations are those of the I18NProvider: all of them for the
locale when the request names no keys, otherwise the keys of the requested
chunks, as listed in vaadin-i18n/i18n.json, together with the
requested keys. Which bundle answers for the locale is up to the
provider.
This is a SessionlessRequestHandler, so the I18NProvider is
called without a VaadinSession: it gets the
requested locale and must not depend on
VaadinSession.getCurrent().
For internal use only. May be renamed or removed in a future release.
- Since:
- 24.4
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTranslationFileRequestHandler(I18NProvider i18NProvider, ClassLoader classLoader) -
Method Summary
Modifier and TypeMethodDescriptionbooleanhandleRequest(VaadinRequest request, VaadinResponse response) Handles translation file requests.
-
Constructor Details
-
TranslationFileRequestHandler
-
-
Method Details
-
handleRequest
Handles translation file requests. Translations only depend on theI18NProviderand the requested locale, so they are served without a session.- Specified by:
handleRequestin interfaceSessionlessRequestHandler- Parameters:
request- the request to handleresponse- the response object to which a response can be written- Returns:
trueif the request was handled,falseif this handler does not handle the given request type- Throws:
IOException- if an IO error occurred- Since:
- 25.4
-