File tree 4 files changed +19
-2
lines changed
controllers/au/org/ala/spatial/portal
services/au/org/ala/spatial/portal
4 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ grails:
22
22
upload :
23
23
maxFileSize : 10000000
24
24
maxRequestSize : 10000000
25
+ i18n :
26
+ region : ' default'
25
27
26
28
layersService :
27
29
url : ' https://spatial.ala.org.au/ws'
Original file line number Diff line number Diff line change @@ -151,7 +151,11 @@ class PortalController {
151
151
config. spApp. each { k , v ->
152
152
spApp. put(k, v. class. newInstance(params. get(k, v)))
153
153
}
154
- config. spApp = spApp
154
+ if (params. get(" lang" )) {
155
+ config. i18n?. currentRegion = params. get(" lang" )
156
+ } else {
157
+ config. i18n?. currentRegion = config. i18n?. region
158
+ }
155
159
156
160
render(view : ' index' ,
157
161
model : [config : config,
Original file line number Diff line number Diff line change 16
16
package au.org.ala.spatial.portal
17
17
18
18
import org.apache.commons.io.FileUtils
19
+ import org.apache.logging.log4j.util.Strings
19
20
20
21
/**
21
22
* Helper class for invoking other ALA web services.
@@ -29,6 +30,10 @@ class PropertiesService {
29
30
def defaultFile = " ${ name} .properties" ;
30
31
def properties = new Properties ()
31
32
33
+ // Load default English properties
34
+ def defaultProperties = new Properties ()
35
+ defaultProperties. load(new StringReader (PortalController . classLoader. getResourceAsStream(" messages.properties" )?. text))
36
+
32
37
def text = PortalController . classLoader. getResourceAsStream(" $defaultFile " )?. text
33
38
if (text) {
34
39
properties. load(new StringReader (text))
@@ -54,6 +59,12 @@ class PropertiesService {
54
59
if (file. exists()) {
55
60
properties. load(new FileReader (file))
56
61
}
62
+ // Use default English properties if the required lang is not available
63
+ defaultProperties. each{
64
+ if (! properties. getProperty(it. key)){
65
+ properties. setProperty(it. key, it. value)
66
+ }
67
+ }
57
68
58
69
if (properties. size() == 0 && type != ' messages' ) {
59
70
get(' messages' )
Original file line number Diff line number Diff line change 144
144
, ' ${ config. doiService. url } /**'
145
145
< / g: if >
146
146
],
147
- i18n: ' ${ config. i18n? . region ?: " default" } ' ,
147
+ i18n: ' ${ config. i18n? . currentRegion ?: " default" } ' ,
148
148
editable: ${params .edit ?: ' false' },
149
149
wmsIntersect: ${config .wms .intersect },
150
150
projections: ${(config .projections as grails .converters .JSON ).toString ().encodeAsRaw ()},
You can’t perform that action at this time.
0 commit comments