public class Symphony.Language

admin.js

The Language object stores the dictionary with all needed translations. It offers public functions to add strings and get their translation and it offers private functions to handle variables and get the translations via an synchronous AJAX request.

Properties

publicstatic
static NAME

Deprecated

You should now use Symphony.Context.get('lang')

Methods

public static
admin.js
static Language()

The Language object stores the dictionary with all needed translations. It offers public functions to add strings and get their translation and it offers private functions to handle variables and get the translations via an synchronous AJAX request.

public static
static add(Object $strings)

Add strings to the Dictionary

Parameters
  • $strings ObjectObject with English string as key, value should be false

public static
static String get(String $string, Object $inserts)

Get translated string from the Dictionary. The function replaces variables like {$name} with the a specified value if an object of inserts is passed in the function call.

Parameters
  • $string StringEnglish string to be translated

  • $inserts ObjectObject with variable name and value pairs

Returns

Returns the translated string

public static
static String insert(String $string, Object $inserts)

This private function replaces variables with a specified value. It should not be called directly.

Parameters
  • $string StringTranslated string with variables

  • $inserts ObjectObject with variable name and value pairs

Returns

Returns translated strings with all variables replaced by their actual value

public static
static Object translate(Object $strings)

This private function sends a synchronous AJAX request to fetch the translations for the English strings in the dictionary. It should not be called directly

Parameters
  • $strings ObjectObject of strings to be translated

Returns

Object with original string and translation pairs

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details