Wiki source code of Language Macro
Version 39.1 by Simon Urli on 2024/07/22
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | = Example = | ||
2 | |||
3 | == Code == | ||
4 | |||
5 | {{code}} | ||
6 | {{language codes='de, fr, it, lv, nl, ru, sv, zh'/}} | ||
7 | {{/code}} | ||
8 | |||
9 | == Result == | ||
10 | |||
11 | {{language codes="de, fr, it, lv, nl, ru, sv, zh"/}} | ||
12 | |||
13 | = Parameters = | ||
14 | |||
15 | |= Parameter name |= Description | ||
16 | | codes | indicates the code list for the language | ||
17 | |||
18 | Codes that can be used: | ||
19 | {{velocity}}|= Code |= Flag |= Language name | ||
20 | #foreach($attachment in $doc.attachmentList) | ||
21 | #set($locale = $attachment.filename.substring(0, $attachment.filename.indexOf('.')).replace('-', '_')) | ||
22 | | $locale | image:$attachment.filename | $!{languages.get($locale).get(0)} | ||
23 | #end{{/velocity}} | ||
24 | |||
25 | == References == | ||
26 | |||
27 | The locale code is based on [[<ISO 639-1 language code>>>https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes]]_[[<COUNTRY UPPER CASE>>>https://en.wikipedia.org/wiki/ISO_3166-1]] | ||
28 | |||
29 | The flag need to be attachmed and the filename needs to be <locale>.png (for example ##pt_BR.png##). All the flags currently attached comes from [[http://www.famfamfam.com/lab/icons/flags/]]. | ||
30 | |||
31 | The display name needs to be added in the ##XWiki.WikiMacroClass## object. |