mirror of
https://github.com/danog/docker-php-extension-installer.git
synced 2024-11-30 04:29:15 +01:00
Support installing custom languages for pspell (#621)
This commit is contained in:
parent
96362b2ba3
commit
51b16e983b
@ -372,6 +372,7 @@ Here's the list of all the supported environment variables:
|
||||
| gd | `IPE_GD_WITHOUTAVIF=1` | Since PHP 8.1, gd supports the AVIF format. Enabling it requires compiling libaom/libdav1d/libyuv/libavif, which is time-consuming. You can disable AVIF support by setting this environment variable |
|
||||
| oci8 & pdo_oci | `IPE_INSTANTCLIENT_BASIC=1` | The oci8 and pdo_oci PHP extensions require [Oracle Instant Client](https://www.oracle.com/database/technologies/instant-client.html). In order to save disk space, we install the Basic Lite version: if you want to install the Basic (non-lite) version simply set this environment variable |
|
||||
| http, intl, mongodb | `IPE_ICU_EN_ONLY=1` | Some extensions require the ICU library, use this flag to install a smaller, but English-only, ICU library on Alpine 3.16 and later |
|
||||
| pspell | `IPE_ASPELL_LANGUAGES='...'` | Configure the languages to be made available (for example: `IPE_ASPELL_LANGUAGES='en fr'`). If omitted, we'll assume `en` |
|
||||
|
||||
## Special requirements
|
||||
|
||||
|
@ -570,6 +570,17 @@ sortModulesToInstall() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Expand the IPE_ASPELL_LANGUAGES environment variable into apk/apt package names
|
||||
expandASpellDictionaries() {
|
||||
expandASpellDictionaries_languages="${IPE_ASPELL_LANGUAGES:-en}"
|
||||
expandASpellDictionaries_result=''
|
||||
resetIFS
|
||||
for expandASpellDictionaries_language in $expandASpellDictionaries_languages; do
|
||||
expandASpellDictionaries_result="$expandASpellDictionaries_result aspell-$expandASpellDictionaries_language"
|
||||
done
|
||||
printf '%s' "${expandASpellDictionaries_result# }"
|
||||
}
|
||||
|
||||
# Get the required APT/APK packages for a specific PHP version and for the list of module handles
|
||||
#
|
||||
# Arguments:
|
||||
@ -1054,11 +1065,11 @@ buildRequiredPackageLists() {
|
||||
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++"
|
||||
;;
|
||||
pspell@alpine)
|
||||
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent aspell-libs"
|
||||
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent aspell-libs $(expandASpellDictionaries)"
|
||||
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile aspell-dev"
|
||||
;;
|
||||
pspell@debian)
|
||||
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libaspell15"
|
||||
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libaspell15 $(expandASpellDictionaries)"
|
||||
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libpspell-dev"
|
||||
;;
|
||||
rdkafka@alpine)
|
||||
|
@ -328,7 +328,7 @@ testExtensionFor() {
|
||||
printf ' - Docker image: %s\n' "$testExtensionFor_Image"
|
||||
testExtensionFor_out="$(mktemp)"
|
||||
testExtensionFor_start=$(date +%s)
|
||||
if $(docker run --rm --volume "$CI_BUILD_DIR:/app" --env CI=true --env IPE_FIX_CACERTS=1 --workdir /app "$testExtensionFor_Image" sh -c "./install-php-extensions $1 && php ./scripts/check-installed-extension.php $1" >"$testExtensionFor_out" 2>&1); then
|
||||
if $(docker run --rm --volume "$CI_BUILD_DIR:/app" --env CI=true --env IPE_FIX_CACERTS=1 --env IPE_ASPELL_LANGUAGES='en fr' --workdir /app "$testExtensionFor_Image" sh -c "./install-php-extensions $1 && php ./scripts/check-installed-extension.php $1" >"$testExtensionFor_out" 2>&1); then
|
||||
testExtensionFor_end=$(date +%s)
|
||||
testExtensionFor_delta=$(expr $testExtensionFor_end - $testExtensionFor_start)
|
||||
rm -rf "$testExtensionFor_out"
|
||||
|
31
scripts/tests/pspell
Executable file
31
scripts/tests/pspell
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/_bootstrap.php';
|
||||
|
||||
const ENGLISH_ONLY_WORD = 'Goodbye';
|
||||
const FRENCH_ONLY_WORD = 'Merci';
|
||||
|
||||
$rc = 0;
|
||||
|
||||
$english = pspell_new('en');
|
||||
$french = pspell_new('fr');
|
||||
|
||||
if (pspell_check($english, ENGLISH_ONLY_WORD) !== true) {
|
||||
fwrite(STDERR, "pspell failed to detect a correct English word ('" . ENGLISH_ONLY_WORD . "') as correct\n");
|
||||
$rc = 1;
|
||||
}
|
||||
if (pspell_check($french, ENGLISH_ONLY_WORD) !== false) {
|
||||
fwrite(STDERR, "pspell failed to detect a wrong French word ('" . ENGLISH_ONLY_WORD . "') as wrong\n");
|
||||
$rc = 1;
|
||||
}
|
||||
if (pspell_check($english, FRENCH_ONLY_WORD) !== false) {
|
||||
fwrite(STDERR, "pspell failed to detect a wrong English word ('" . FRENCH_ONLY_WORD . "') as wrong\n");
|
||||
$rc = 1;
|
||||
}
|
||||
if (pspell_check($french, FRENCH_ONLY_WORD) !== true) {
|
||||
fwrite(STDERR, "pspell failed to detect a correct French word ('" . FRENCH_ONLY_WORD . "') as correct\n");
|
||||
$rc = 1;
|
||||
}
|
||||
|
||||
exit($rc);
|
Loading…
Reference in New Issue
Block a user