Newscoop 3 Cookbook

List languages

List of Languages

Note: this works only in Newscoop 3.2.1 and newer versions.

Purpose:

Select the list of languages according to the given constraints and current environmental variables. The language variable may not be defined outside the list_languages statement; inside the statement however, this variable is defined. The code between the {{list_languages}} statement and {{/list_languages}} is repeated for every language in the list.

Syntax:

{{ list_languages [length="<integer_value>"]
                  [columns="<integer_value>"]
                  [of_publication="true|false"]
                  [of_issue="true|false"]
                  [of_article="true|false"]
                  [exclude_current="true|false"]
                  [order="<order_condition>"] }}
   <list_of_instructions>
{{ /list_languages }}

Filters:

  • length="<integer_value>": <integer_value> specifies the list_length and forces the list to have at most list_length items. If the list contains more items than list_length items the interval of elements to be displayed can be switched using has_previous_elements and has_next_elements from the current_list object.
  • columns="<integer_value>":<integer_value> specifies the list columns_number and sets an environment variable. This is incremented as if the items were placed in a table cell. The counting starts from one and the variable is incremented for every new element. When it reaches the maximum value it is reset to one. This is very useful in building tables of data. For details see current_list.
  • of_publication: if true, will list languages in which publication issues were translated
  • of_issue: if true, will list languages in which the current issue was translated
  • of_article: if true, will list languages in which the current article was translated
  • exclude_current: if true, will not include the current language in the list

When none of the three attributes (of_publication, of_issue, of_section) was specified it will list all available languages in Newscoop.

<list_of_instructions> may contain any statement except those listed at the end of the page.

  • <order_condition>=
    • byNumber desc|asc
    • byName desc|asc
    • byEnglish_Name desc|asc
    • byCode desc|asc

Order conditions are self-explanatory.

Inside the list, the following environment variable is modified:

  • language: if not defined before list start

The environment is restored after the list ends.

Constraints:

Inside list_issues the following statements are forbidden:

  • set_language
  • set_default_language
  • unset_language
  • list_languages