Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
"git-lfs",
"go",
"jfrog-cli",
"locale",
"make",
"mingw",
"node",
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Below is a list with included features, click on the link for more details.
| [go](./features/src/go/README.md) | A feature which installs Go. |
| [instant-client](./features/src/instant-client/README.md) | A feature which installs the Oracle Instant Client basic package |
| [jfrog-cli](./features/src/jfrog-cli/README.md) | A feature which installs the JFrog CLI. |
| [locale](./features/src/locale/README.md) | A feature which configures system locale and language settings. |
| [make](./features/src/make/README.md) | A feature which installs GNU Make. |
| [mingw](./features/src/mingw/README.md) | A feature which installs MinGW (Minimalist GNU for Windows) cross-compilers and tools. |
| [node](./features/src/node/README.md) | A package which installs Node.js. |
Expand Down
12 changes: 12 additions & 0 deletions build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var featureList = []string{
"go",
"instant-client",
"jfrog-cli",
"locale",
"make",
"mingw",
"node",
Expand Down Expand Up @@ -145,6 +146,17 @@ func init() {
return publishFeature("jfrog-cli")
})

////////// locale
gotaskr.Task("Feature:locale:Package", func() error {
return packageFeature("locale")
})
gotaskr.Task("Feature:locale:Test", func() error {
return testFeature("locale")
})
gotaskr.Task("Feature:locale:Publish", func() error {
return publishFeature("locale")
})

////////// make
gotaskr.Task("Feature:make:Package", func() error {
return packageFeature("make")
Expand Down
16 changes: 16 additions & 0 deletions features/src/locale/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Notes

Currently, you still need to add the appropriate language as environment variable to your container. You can do this in the `devcontainer.json` file like:
```json
{
"containerEnv": {
"LANG": "de_CH.UTF-8",
"LANGUAGE": "de_CH.UTF-8",
"LC_ALL": "de_CH.UTF-8"
}
}
```

### System Compatibility

Debian, Ubuntu
36 changes: 36 additions & 0 deletions features/src/locale/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Set a specific locale (locale)

A package which allows setting the locale.

## Example Usage

```json
"features": {
"ghcr.io/postfinance/devcontainer-features/locale:0.1.0": {
"locale": "en_US"
}
}
```

## Options

| Option | Description | Type | Default Value | Proposals |
|-----|-----|-----|-----|-----|
| locale | The locale to set. | string | en_US | de_CH, en_US |

## Notes

Currently, you still need to add the appropriate language as environment variable to your container. You can do this in the `devcontainer.json` file like:
```json
{
"containerEnv": {
"LANG": "de_CH.UTF-8",
"LANGUAGE": "de_CH.UTF-8",
"LC_ALL": "de_CH.UTF-8"
}
}
```

### System Compatibility

Debian, Ubuntu
17 changes: 17 additions & 0 deletions features/src/locale/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"id": "locale",
"version": "0.1.0",
"name": "Set a specific locale",
"description": "A package which allows setting the locale.",
"options": {
"locale": {
"type": "string",
"proposals": [
"de_CH",
"en_US"
],
"default": "en_US",
"description": "The locale to set."
}
}
}
4 changes: 4 additions & 0 deletions features/src/locale/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/*

localedef -i $LOCALE -f UTF-8 $LOCALE.UTF-8
update-locale LANG=$LOCALE.UTF-8
11 changes: 11 additions & 0 deletions features/test/locale/de_ch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -e

[[ -f "$(dirname "$0")/../functions.sh" ]] && source "$(dirname "$0")/../functions.sh"
[[ -f "$(dirname "$0")/functions.sh" ]] && source "$(dirname "$0")/functions.sh"

check_version "$(locale -k LC_TIME)" "abday=\"So;Mo;Di;Mi;Do;Fr;Sa\""

check_version "$(env)" "LANG=de_CH.UTF-8"
check_version "$(env)" "LANGUAGE=de_CH.UTF-8"
check_version "$(env)" "LC_ALL=de_CH.UTF-8"
11 changes: 11 additions & 0 deletions features/test/locale/en_us.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -e

[[ -f "$(dirname "$0")/../functions.sh" ]] && source "$(dirname "$0")/../functions.sh"
[[ -f "$(dirname "$0")/functions.sh" ]] && source "$(dirname "$0")/functions.sh"

check_version "$(locale -k LC_TIME)" "abday=\"Sun;Mon;Tue;Wed;Thu;Fri;Sat\""

check_version "$(env)" "LANG=en_US.UTF-8"
check_version "$(env)" "LANGUAGE=en_US.UTF-8"
check_version "$(env)" "LC_ALL=en_US.UTF-8"
38 changes: 38 additions & 0 deletions features/test/locale/scenarios.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"de_ch": {
"build": {
"dockerfile": "Dockerfile",
"options": [
"--add-host=host.docker.internal:host-gateway"
]
},
"features": {
"./locale": {
"locale": "de_CH"
}
},
"containerEnv": {
"LANG": "de_CH.UTF-8",
"LANGUAGE": "de_CH.UTF-8",
"LC_ALL": "de_CH.UTF-8"
}
},
"en_us": {
"build": {
"dockerfile": "Dockerfile",
"options": [
"--add-host=host.docker.internal:host-gateway"
]
},
"features": {
"./locale": {
"locale": "en_US"
}
},
"containerEnv": {
"LANG": "en_US.UTF-8",
"LANGUAGE": "en_US.UTF-8",
"LC_ALL": "en_US.UTF-8"
}
}
}
5 changes: 5 additions & 0 deletions features/test/locale/test-images.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
"mcr.microsoft.com/devcontainers/base:debian-11",
"mcr.microsoft.com/devcontainers/base:debian-12",
"mcr.microsoft.com/devcontainers/base:ubuntu-24.04"
]