Skip to content

v3: broken locale support (gettext) #305

@mnapoli

Description

@mnapoli

PHP's gettext localization fails to switch languages correctly unless we add the following to the Dockerfile. (Note: The current v2 image docker pull bref/php-83-fpm-dev:latest does not have this issue.)

# Install locale packages for multi-language support
RUN microdnf update -y && \
    microdnf install -y glibc-langpack-en glibc-langpack-ja && \
    microdnf clean all

# Set default locale environment
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

Example code:

English:

bindtextdomain('app', base_path() . '/lang/locale');
textdomain('app');
setlocale(LC_ALL, "en_US.UTF-8");
putenv("LANGUAGE=en_US.UTF-8");

Japanese:

bindtextdomain('app', base_path() . '/lang/locale');
textdomain('app');
setlocale(LC_ALL, "ja_JP.UTF-8");
putenv("LANGUAGE=ja_JP.UTF-8");

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions