FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

Preside Extension: Multilingual REST request handling

v1.0.5 Public

Preside Extension: Multilingual REST request handling

This is an extension for Preside that provides the ability to perform multilingual REST requests.

Usage

The extension provides a system configuration screen that allows you to configure:

  • Support default HTTP header: accept i18n requests that use 'Accept-language'
  • Custom HTTP Header: optionally a custom HTTP request header to check for a valid language code (defaults to X-LANGUAGE)

Accept-language is a standard HTTP header field, see Wikipedia for details.

If for any reason both headers are supplied, then Accept-language takes precedence.

The following language formats can be used:

  • en, fr, de, etc. (ISO 639-1 code)
  • en-US, de-DE, etc. (in this case only the first part is evaluated as Preside currently only supports two-letter ISO 639-1 codes)

In case of an invalid language code, the system falls back to the default language. The concept only works if your application deals with multilingual Preside objects. Documentation: Preside - Multilingual content

cURL example

See following example requests

curl -X GET --header 'Accept-language: de-DE' 'http://servername:serverport/api/myrestapiendpoint/'
curl -X GET --header 'Accept-language: en' 'http://servername:serverport/api/myrestapiendpoint/'
curl -X GET --header 'X-LANGUAGE: fr-FR' 'http://servername:serverport/api/myrestapiendpoint/'

Installation

Install the extension to your application via either of the methods detailed below (Git submodule / CommandBox) and then enable the extension by opening up the Preside developer console and entering:

extension enable preside-ext-rest-i18n
reload all

Git Submodule method

From the root of your application, type the following command:

git submodule add https://bitbucket.org/hwsdev/preside-ext-rest-i18n.git application/extensions/preside-ext-rest-i18n

CommandBox (box.json) method

From the root of your application, type the following command:

box install preside-ext-rest-i18n

Here are all the versions for this package. Please note that you can leverage CommandBox package versioning to install any package you like. Please refer to our managing package version guide for more information.

Version Created Last Update Published By Stable Actions
Current
1.0.5 Oct 18 2016 11:08 AM Oct 18 2016 11:08 AM
Version History
1.0.4 Oct 16 2016 02:38 PM Oct 16 2016 02:38 PM
1.0.3 Oct 16 2016 01:05 PM Oct 16 2016 01:05 PM
1.0.2 Oct 14 2016 09:07 AM Oct 14 2016 09:07 AM
1.0.1 Sep 30 2016 04:58 AM Sep 30 2016 04:58 AM
1.0.0 Sep 29 2016 12:11 PM Sep 29 2016 12:11 PM

 

No collaborators yet.
     
  • Sep 29 2016 12:11 PM
  • Oct 18 2016 11:08 AM
  • 729
  • 1,559
  • 225