Made possible to save translations into file.

Minor fixes...
This commit is contained in:
Prominence 2016-06-28 11:53:32 +03:00
parent e2e134b352
commit e0fe33ecbf
3 changed files with 13 additions and 8 deletions

View File

@ -47,17 +47,20 @@ class TranslationsOverviewController {
Bundle bundle = bundleService.findBundleByName(params.bundleName as String)
Language language = bundle.languages.find { Language lang ->
lang.languageTag = params.lang
lang.languageTag == params.lang
}
params.each { String key, value ->
if (key.startsWith('translations.')) {
key = key.substring(key.indexOf('.') + 1)
language.translations."${key}" = value
}
}
language.languageFile.newWriter().withWriter { w ->
language.translations.each { key, value ->
language.languageFile.write("${key} = ${value}\n")
w << ("${key} = ${value}\n")
}
}
if (params.bundleName) {

View File

@ -82,10 +82,10 @@ class BundleService {
}
private String getKey(String line) {
return line.substring(0, line.indexOf('='))
return line.substring(0, line.indexOf('=')).trim()
}
private String getValue(String line) {
return line.substring(line.indexOf('=') + 1)
return line.substring(line.indexOf('=') + 1).trim()
}
}

View File

@ -20,9 +20,11 @@
<tbody>
<tr>
<g:each in="${bundle.languages}" var="language">
<td>${language.translations.each {key, value ->
print (key + '=' + value)
}}</td>
<td>
<g:each in="${language.translations}" var="translation">
${translation.key} = ${translation.value} </br>
</g:each>
</td>
</g:each>
</tr>
<tr>