Skip to content

Commit 503fa36

Browse files
committed
Fix #35505: send lang as env var
1 parent 5cf4e86 commit 503fa36

3 files changed

Lines changed: 53 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* ContainerProxy
3+
*
4+
* Copyright (C) 2016-2026 Open Analytics
5+
*
6+
* ===========================================================================
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the Apache License as published by
10+
* The Apache Software Foundation, either version 2 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* Apache License for more details.
17+
*
18+
* You should have received a copy of the Apache License
19+
* along with this program. If not, see <http://www.apache.org/licenses/>
20+
*/
21+
package eu.openanalytics.containerproxy.model.runtime.runtimevalues;
22+
23+
public class LanguageKey extends RuntimeValueKey<String> {
24+
25+
public static final LanguageKey inst = new LanguageKey();
26+
27+
private LanguageKey() {
28+
super("openanalytics.eu/sp-language",
29+
"SHINYPROXY_LANGUAGE",
30+
false,
31+
true,
32+
true,
33+
false, // no need to expose in API
34+
true,
35+
false,
36+
String.class);
37+
}
38+
39+
@Override
40+
public String deserializeFromString(String value) {
41+
return value;
42+
}
43+
44+
@Override
45+
public String serializeToString(String value) {
46+
return value;
47+
}
48+
49+
}

src/main/java/eu/openanalytics/containerproxy/model/runtime/runtimevalues/RuntimeValueKeyRegistry.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public class RuntimeValueKeyRegistry {
5353
addRuntimeValueKey(HttpHeadersKey.inst);
5454
addRuntimeValueKey(TargetIdKey.inst);
5555
addRuntimeValueKey(CacheHeadersModeKey.inst);
56+
addRuntimeValueKey(LanguageKey.inst);
5657
}
5758

5859
public static void addRuntimeValueKey(RuntimeValueKey<?> key) {

src/main/java/eu/openanalytics/containerproxy/service/ProxyService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import eu.openanalytics.containerproxy.model.runtime.ProxyStartupLog;
3838
import eu.openanalytics.containerproxy.model.runtime.ProxyStatus;
3939
import eu.openanalytics.containerproxy.model.runtime.ProxyStopReason;
40+
import eu.openanalytics.containerproxy.model.runtime.runtimevalues.LanguageKey;
4041
import eu.openanalytics.containerproxy.model.runtime.runtimevalues.RuntimeValue;
4142
import eu.openanalytics.containerproxy.model.spec.ContainerSpec;
4243
import eu.openanalytics.containerproxy.model.spec.ProxySpec;
@@ -49,6 +50,7 @@
4950
import org.slf4j.LoggerFactory;
5051
import org.springframework.context.ApplicationEventPublisher;
5152
import org.springframework.context.annotation.Lazy;
53+
import org.springframework.context.i18n.LocaleContextHolder;
5254
import org.springframework.core.env.Environment;
5355
import org.springframework.data.util.Pair;
5456
import org.springframework.security.access.AccessDeniedException;
@@ -318,6 +320,7 @@ public Command startProxy(Authentication user, ProxySpec spec, List<RuntimeValue
318320
if (runtimeValues != null) {
319321
proxyBuilder.addRuntimeValues(runtimeValues);
320322
}
323+
proxyBuilder.addRuntimeValue(new RuntimeValue(LanguageKey.inst, LocaleContextHolder.getLocale().getLanguage()), true);
321324

322325
Proxy currentProxy = runtimeValueService.processParameters(user, spec, parameters, proxyBuilder.build());
323326
proxyStore.addProxy(currentProxy);

0 commit comments

Comments
 (0)