Changes for page Internationalization

Last modified by Thomas Mortagne on 2023/10/10

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

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.VincentMassol
1 +XWiki.mflorea
Content
... ... @@ -4,14 +4,35 @@
4 4  
5 5  XWiki can be set-up to support one or various languages.
6 6  
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:
7 +{{groovy}}
8 +import groovy.json.*
10 10  
11 -{{language showCode="true" codes="#foreach($locale in $locales)#if($locale.locale!='none')#if($foreach.index > 0),#end$locale.locale#end#end"/}}
12 -{{/velocity}}
10 +def languages = []
11 +def stop = false
12 +def counter = 1
13 +def total = 0
13 13  
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 +}
14 14  
29 +println "XWiki has translations in ${total} languages:"
30 +
31 +languages.each() {
32 + println "* ${it}"
33 +}
34 +{{/groovy}}
35 +
15 15  If you wish to help out improve translations, check our [[translation platform>>http://l10n.xwiki.org]].
16 16  
17 17  = Preferences =

Get Connected