Changes for page Internationalization

Last modified by Thomas Mortagne on 2023/10/10

From version 51.1
edited by Marius Dumitru Florea
on 2021/02/23
Change comment: There is no comment for this version
To version 51.2
edited by Vincent Massol
on 2021/03/10
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.mflorea
1 +XWiki.VincentMassol
Content
... ... @@ -4,35 +4,14 @@
4 4  
5 5  XWiki can be set-up to support one or various languages.
6 6  
7 -{{groovy}}
8 -import groovy.json.*
7 +{{velocity}}
8 +#set($locales = $xwiki.getDocument('dev:Community.L10N.SupportedLocales.WebHome').getObjects('dev:Community.L10N.SupportedLocales.Code.LocaleClass'))
9 +XWiki has translations in ${locales.size()} languages:
9 9  
10 -def languages = []
11 -def stop = false
12 -def counter = 1
13 -def total = 0
11 +{{language showCode="true" codes="#foreach($locale in $locales)#if($locale.locale!='none')#if($foreach.index > 0),#end$locale.locale#end#end"/}}
12 +{{/velocity}}
14 14  
15 -while (!stop) {
16 - def json = "https://l10n.xwiki.org/api/languages/?page=${counter}".toURL()
17 - .getText(requestProperties: [Accept: 'application/json', Authorization: 'q6VxVYaJL7cg2ceCAubkl9vXrLzyshOHa3GlG5RX'])
18 - def root = new JsonSlurper().parseText(json)
19 - root.results.each() {
20 - languages.add("[[${it.name} (${it.code})>>https://l10n.xwiki.org/languages/${it.code}/]]")
21 - total++
22 - }
23 - counter++
24 - if (!root.next) {
25 - stop = true
26 - }
27 -}
28 28  
29 -println "XWiki has translations in ${total} languages:"
30 -
31 -languages.each() {
32 - println "* ${it}"
33 -}
34 -{{/groovy}}
35 -
36 36  If you wish to help out improve translations, check our [[translation platform>>http://l10n.xwiki.org]].
37 37  
38 38  = Preferences =

Get Connected