Skip to content

Commit 724ebc1

Browse files
committed
fix: use icu locale with natural ordering enabled
Tests appear to still be failing, but a quick look around seem to indicate the tests aren't right now... (:
1 parent 8f34749 commit 724ebc1

File tree

6 files changed

+21
-3
lines changed

6 files changed

+21
-3
lines changed

backend/app/src/main/kotlin/io/tolgee/postgresRunners/PostgresDockerRunner.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class PostgresDockerRunner(
2424
stopBeforeStart = false,
2525
env =
2626
mapOf(
27+
"POSTGRES_INITDB_ARGS" to "--locale-provider=icu\\ --icu-locale=und-u-kn-true", // https://github.com/docker-library/postgres/issues/1004#issuecomment-1280559846
2728
"POSTGRES_PASSWORD" to postgresAutostartProperties.password,
2829
"POSTGRES_USER" to postgresAutostartProperties.user,
2930
"POSTGRES_DB" to postgresAutostartProperties.databaseName,

backend/misc/src/main/kotlin/io/tolgee/misc/dockerRunner/DockerContainerRunner.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ class DockerContainerRunner(
126126
timeoutAmount: Long,
127127
timeoutUnit: TimeUnit,
128128
): Process {
129-
return ProcessBuilder("\\s+".toRegex().split(this.trim()))
129+
val transformed = "(?<!\\\\)\\s+".toRegex().split(this.trim())
130+
.map { it.replace("\\ ", " ") }
131+
132+
return ProcessBuilder(transformed)
130133
.directory(workingDir)
131134
.redirectOutput(ProcessBuilder.Redirect.PIPE)
132135
.redirectError(ProcessBuilder.Redirect.PIPE)

build.gradle

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,14 @@ project(':server-app').afterEvaluate {
9090
task startDbChangelogContainer {
9191
doLast {
9292
exec {
93-
commandLine "docker", "run", "-e", "POSTGRES_PASSWORD=postgres", "-d", "-p55538:5432", "--name", dbSchemaContainerName, "postgres:16.8-alpine3.21"
93+
commandLine "docker", "run",
94+
"-e", "POSTGRES_PASSWORD=postgres",
95+
// https://github.com/docker-library/postgres/issues/1004#issuecomment-1280559846
96+
"-e", "POSTGRES_INITDB_ARGS=--locale-provider=icu --icu-locale=und-u-kn-true",
97+
"-d",
98+
"-p55538:5432",
99+
"--name", dbSchemaContainerName,
100+
"postgres:16.8-alpine3.21"
94101
}
95102
Thread.sleep(5000)
96103
}

docker/app/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
FROM postgres:16.8-alpine3.21
22

3+
# https://github.com/docker-library/postgres/issues/1004#issuecomment-1280559846
4+
ENV POSTGRES_INITDB_ARGS "--locale-provider=icu --icu-locale=und-u-kn-true"
5+
36
ENTRYPOINT []
47

58
RUN apk --no-cache add openjdk21

docker/docker-compose.template.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ services:
22
db:
33
image: postgres:16.8-alpine3.21
44
environment:
5+
# https://github.com/docker-library/postgres/issues/1004#issuecomment-1280559846
6+
- POSTGRES_INITDB_ARGS=--locale-provider=icu -icu-locale=und-u-kn-true
57
- POSTGRES_PASSWORD=postgres
68
app:
79
image: tolgee/tolgee

docker/docker-compose.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ services:
44
volumes:
55
- ../build/db-data:/var/lib/postgresql/data/
66
environment:
7+
# https://github.com/docker-library/postgres/issues/1004#issuecomment-1280559846
8+
- POSTGRES_INITDB_ARGS=--locale-provider=icu --icu-locale=und-u-kn-true
79
- POSTGRES_PASSWORD=postgres
810
app:
911
image: tolgee/tolgee
@@ -14,4 +16,4 @@ services:
1416
depends_on:
1517
- "db"
1618
smtp:
17-
image: namshi/smtp
19+
image: namshi/smtp

0 commit comments

Comments
 (0)