Resources for Developers

Locale Buildpack

Purpose of this buildpack

The environment used to build and run applications, based on Ubuntu, only includes the English language pack. You may still want to use a custom language pack. The locale buildpack aims at installing additional language packs.

Details about the default environment can be found on the following page: Scalingo Builder - Our base Docker image

Set up this buildpack for your application

This buildpack is designed to be used in conjunction with one or more additional buildpacks, thanks to the multi buildpack.

For instance, when creating a new Ruby app on Scalingo:

$ scalingo create my-app
$ scalingo env-set BUILDPACK_URL=https://github.com/Scalingo/multi-buildpack.git

$ cat << EOF > .buildpacks
https://github.com/Scalingo/locale-buildpack.git
https://github.com/Scalingo/ruby-buildpack.git
EOF

The above commands configure your application to use the multi buildpack, and define the .buildpacks file. This file configures the different buildpacks to apply. In this example, we configure the locale and the Ruby buildpack.

Configuration

Once the buildpack is configured for your app, the language pack to install have to be defined in a file named .locales which should be located at the root of the application.

This file contains one locale per line. For instance, to add German and French language pack, this file must contain:

de_DE
fr_FR

Commit that file and trigger a new build. The specified locales will be installed by the buildpack.

Output

At the next deployment, the locale buildpack will install the required language packs:

=====> Downloading Buildpack: https://github.com/Scalingo/locale-buildpack.git
=====> Detected Framework: Locale
=== Updating or installing language-pack-de-base
Ign http://archive.ubuntu.com trusty InRelease
Get:1 http://archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Get:2 http://archive.ubuntu.com trusty-security InRelease [65.9 kB]

[...]

Fetched 23.2 MB in 15s (1477 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
The following extra packages will be installed:
  language-pack-de
The following NEW packages will be installed:
  language-pack-de language-pack-de-base
0 upgraded, 2 newly installed, 0 to remove and 97 not upgraded.
Need to get 3068 kB of archives.
After this operation, 13.1 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main language-pack-de-base all 1:14.04+20160720 [3066 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty-updates/main language-pack-de all 1:14.04+20160720 [1810 B]
Fetched 3068 kB in 0s (19.5 MB/s)
Download complete and in download only mode
=== Updating or installing language-pack-fr-base
Ign http://archive.ubuntu.com trusty InRelease
Hit http://archive.ubuntu.com trusty-updates InRelease
Hit http://archive.ubuntu.com trusty-security InRelease

[...]

Reading package lists...
Reading package lists...
Building dependency tree...
The following extra packages will be installed:
  language-pack-fr
The following NEW packages will be installed:
  language-pack-fr language-pack-fr-base
0 upgraded, 2 newly installed, 0 to remove and 97 not upgraded.
Need to get 2681 kB of archives.
After this operation, 11.5 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main language-pack-fr-base all 1:14.04+20160720 [2679 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty-updates/main language-pack-fr all 1:14.04+20160720 [1824 B]
Fetched 2681 kB in 0s (16.4 MB/s)
Download complete and in download only mode
=== Unpacking and configuring all locales

mode_edit Suggest edits