-language-overview Language overview functionality


Functions

 locale_languages_overview_form ()
 locale_languages_overview_form_submit ($form, &$form_state)
 locale_languages_add_screen ()
 locale_languages_predefined_form ()
 locale_languages_custom_form ()
 locale_languages_edit_form (&$form_state, $langcode)
 _locale_languages_common_controls (&$form, $language=NULL)
 locale_languages_predefined_form_validate ($form, &$form_state)
 locale_languages_predefined_form_submit ($form, &$form_state)
 locale_languages_edit_form_validate ($form, &$form_state)
 locale_languages_edit_form_submit ($form, &$form_state)
 locale_languages_delete_form (&$form_state, $langcode)
 locale_languages_delete_form_submit ($form, &$form_state)
 locale_languages_configure_form ()
 locale_languages_configure_form_submit ($form, &$form_state)
 locale_translate_overview_screen ()
 locale_translate_seek_screen ()
 locale_translate_seek_form ()
 locale_translate_import_form ()
 locale_translate_import_form_submit ($form, &$form_state)
 locale_translate_export_screen ()
 locale_translate_export_po_form (&$form_state, $names)
 locale_translate_export_pot_form ()
 locale_translate_export_po_form_submit ($form, &$form_state)
 locale_translate_edit_form (&$form_state, $lid)
 locale_string_is_safe ($string)
 locale_translate_edit_form_validate ($form, &$form_state)
 locale_translate_edit_form_submit ($form, &$form_state)
 locale_translate_delete_page ($lid)
 locale_translate_delete_form (&$form_state, $source)
 locale_translate_delete_form_submit ($form, &$form_state)
 locale_add_language ($langcode, $name=NULL, $native=NULL, $direction=LANGUAGE_LTR, $domain= '', $prefix= '', $enabled=TRUE, $default=FALSE)
 _locale_import_po ($file, $langcode, $mode, $group=NULL)
 _locale_import_read_po ($op, $file, $mode=NULL, $lang=NULL, $group= 'default')
 _locale_import_message ($message, $file, $lineno=NULL)
 _locale_import_one_string ($op, $value=NULL, $mode=NULL, $lang=NULL, $file=NULL, $group= 'default')
 _locale_import_one_string_db (&$report, $langcode, $source, $translation, $textgroup, $location, $mode, $plid=NULL, $plural=NULL)
 _locale_import_parse_header ($header)
 _locale_import_parse_plural_forms ($pluralforms, $filename)
 _locale_import_parse_arithmetic ($string)
 _locale_import_tokenize_formula ($formula)
 _locale_import_append_plural ($entry, $key)
 _locale_import_shorten_comments ($comment)
 _locale_import_parse_quoted ($string)
 _locale_export_get_strings ($language=NULL, $group= 'default')
 _locale_export_po_generate ($language=NULL, $strings=array(), $header=NULL)
 _locale_export_po ($language=NULL, $output=NULL)
 _locale_export_string ($str)
 _locale_export_wrap ($str, $len)
 _locale_export_remove_plural ($entry)
 _locale_translate_seek ()
 _locale_translate_seek_query ()
 _locale_invalidate_js ($langcode=NULL)
 _locale_rebuild_js ($langcode=NULL)
 _locale_translate_language_list ($translation, $limit_language)
 _locale_prepare_predefined_list ()
 _locale_get_predefined_list ()
 locale_batch_by_language ($langcode, $finished=NULL, $skip=array())
 locale_batch_by_component ($components, $finished= '_locale_batch_system_finished')
 _locale_batch_build ($files, $finished=NULL, $components=array())
 _locale_batch_import ($filepath, &$context)
 _locale_batch_system_finished ($success, $results)
 _locale_batch_language_finished ($success, $results)

Detailed Description

End of "locale-language-overview"

End of "locale-language-add-edit"

End of "locale-languages-negotiation"

End of "locale-translate-overview"

End of "locale-translate-seek"

End of "locale-translate-import"

End of "locale-translate-export"

End of "locale-translate-edit"

End of "locale-translate-delete"

End of "locale-api-add"

End of "locale-api-export"

End of "locale-api-seek"

End of "locale-api-languages-predefined"


Function Documentation

_locale_batch_build ( files,
finished = NULL,
components = array() 
)

Build a locale batch from an array of files.

Parameters:
$files Array of files to import
$finished Optional finished callback for the batch.
$components Optional list of component names the batch covers. Used in the installer.
Returns:
A batch structure

_locale_batch_import ( filepath,
&$  context 
)

Perform interface translation import as a batch step.

Parameters:
$filepath Path to a file to import.
$results Contains a list of files imported.

_locale_batch_language_finished ( success,
results 
)

Finished callback of language addition locale import batch. Inform the user of translation files imported.

_locale_batch_system_finished ( success,
results 
)

Finished callback of system page locale import batch. Inform the user of translation files imported.

_locale_export_get_strings ( language = NULL,
group = 'default' 
)

Generates a structured array of all strings with translations in $language, if given. This array can be used to generate an export of the string in the database.

Parameters:
$language Language object to generate the output for, or NULL if generating translation template.
$group Text group to export PO file from (eg. 'default' for interface translations)

_locale_export_po ( language = NULL,
output = NULL 
)

Write a generated PO or POT file to the output.

Parameters:
$language Language object to generate the output for, or NULL if generating translation template.
$output The PO(T) file to output as a string. See _locale_export_generate_po() on how it can be generated.

_locale_export_po_generate ( language = NULL,
strings = array(),
header = NULL 
)

Generates the PO(T) file contents for given strings.

Parameters:
$language Language object to generate the output for, or NULL if generating translation template.
$strings Array of strings to export. See _locale_export_get_strings() on how it should be formatted.
$header The header portion to use for the output file. Defaults are provided for PO and POT files.

_locale_export_remove_plural ( entry  ) 

Removes plural index information from a string

_locale_export_string ( str  ) 

Print out a string on multiple lines

_locale_export_wrap ( str,
len 
)

Custom word wrapping for Portable Object (Template) files.

_locale_get_predefined_list (  ) 

Some of the common languages with their English and native names

Based on ISO 639 and http://people.w3.org/rishida/names/languages.html

_locale_import_append_plural ( entry,
key 
)

Modify a string to contain proper count indices

This is a callback function used via array_map()

Parameters:
$entry An array element
$key Index of the array element

_locale_import_message ( message,
file,
lineno = NULL 
)

Sets an error message occurred during locale file parsing.

Parameters:
$message The message to be translated
$file Drupal file object corresponding to the PO file to import
$lineno An optional line number argument

_locale_import_one_string ( op,
value = NULL,
mode = NULL,
lang = NULL,
file = NULL,
group = 'default' 
)

Imports a string into the database

Parameters:
$op Operation to perform: 'db-store', 'db-report', 'mem-store' or 'mem-report'
$value Details of the string stored
$mode Should existing translations be replaced LOCALE_IMPORT_KEEP or LOCALE_IMPORT_OVERWRITE
$lang Language to store the string in
$file Object representation of file being imported, only required when op is 'db-store'
$group Text group to import PO file into (eg. 'default' for interface translations)

_locale_import_one_string_db ( &$  report,
langcode,
source,
translation,
textgroup,
location,
mode,
plid = NULL,
plural = NULL 
)

Import one string into the database.

Parameters:
$report Report array summarizing the number of changes done in the form: array(inserts, updates, deletes).
$langcode Language code to import string into.
$source Source string.
$translation Translation to language specified in $langcode.
$textgroup Name of textgroup to store translation in.
$location Location value to save with source string.
$mode Import mode to use, LOCALE_IMPORT_KEEP or LOCALE_IMPORT_OVERWRITE.
$plid Optional plural ID to use.
$plural Optional plural value to use.
Returns:
The string ID of the existing string modified or the new string added.

_locale_import_parse_arithmetic ( string  ) 

Parses and sanitizes an arithmetic formula into a PHP expression

While parsing, we ensure, that the operators have the right precedence and associativity.

Parameters:
$string A string containing the arithmetic formula
Returns:
The PHP version of the formula

_locale_import_parse_header ( header  ) 

Parses a Gettext Portable Object file header

Parameters:
$header A string containing the complete header
Returns:
An associative array of key-value pairs

_locale_import_parse_plural_forms ( pluralforms,
filename 
)

Parses a Plural-Forms entry from a Gettext Portable Object file header

Parameters:
$pluralforms A string containing the Plural-Forms entry
$filename A string containing the filename
Returns:
An array containing the number of plurals and a formula in PHP for computing the plural form

_locale_import_parse_quoted ( string  ) 

Parses a string in quotes

Parameters:
$string A string specified with enclosing quotes
Returns:
The string parsed from inside the quotes

_locale_import_po ( file,
langcode,
mode,
group = NULL 
)

Parses Gettext Portable Object file information and inserts into database

Parameters:
$file Drupal file object corresponding to the PO file to import
$langcode Language code
$mode Should existing translations be replaced LOCALE_IMPORT_KEEP or LOCALE_IMPORT_OVERWRITE
$group Text group to import PO file into (eg. 'default' for interface translations)

_locale_import_read_po ( op,
file,
mode = NULL,
lang = NULL,
group = 'default' 
)

Parses Gettext Portable Object file into an array

Parameters:
$op Storage operation type: db-store or mem-store
$file Drupal file object corresponding to the PO file to import
$mode Should existing translations be replaced LOCALE_IMPORT_KEEP or LOCALE_IMPORT_OVERWRITE
$lang Language code
$group Text group to import PO file into (eg. 'default' for interface translations)

_locale_import_shorten_comments ( comment  ) 

Generate a short, one string version of the passed comment array

Parameters:
$comment An array of strings containing a comment
Returns:
Short one string version of the comment

_locale_import_tokenize_formula ( formula  ) 

Backward compatible implementation of token_get_all() for formula parsing

Parameters:
$string A string containing the arithmetic formula
Returns:
The PHP version of the formula

_locale_invalidate_js ( langcode = NULL  ) 

Force the JavaScript translation file(s) to be refreshed.

This function sets a refresh flag for a specified language, or all languages except English, if none specified. JavaScript translation files are rebuilt (with locale_update_js_files()) the next time a request is served in that language.

Parameters:
$langcode The language code for which the file needs to be refreshed.
Returns:
New content of the 'javascript_parsed' variable.

_locale_languages_common_controls ( &$  form,
language = NULL 
)

Common elements of the language addition and editing form.

Parameters:
$form A parent form item (or empty array) to add items below.
$language Language object to edit.

_locale_prepare_predefined_list (  ) 

Prepares the language code list for a select form item with only the unsupported ones

_locale_rebuild_js ( langcode = NULL  ) 

(Re-)Creates the JavaScript translation file for a language.

Parameters:
$language The language, the translation file should be (re)created for.

_locale_translate_language_list ( translation,
limit_language 
)

List languages in search result table

_locale_translate_seek (  ) 

Perform a string search and display results in a table

_locale_translate_seek_query (  ) 

Build array out of search criteria specified in request variables

locale_add_language ( langcode,
name = NULL,
native = NULL,
direction = LANGUAGE_LTR,
domain = '',
prefix = '',
enabled = TRUE,
default = FALSE 
)

API function to add a language.

Parameters:
$langcode Language code.
$name English name of the language
$native Native name of the language
$direction LANGUAGE_LTR or LANGUAGE_RTL
$domain Optional custom domain name with protocol, without trailing slash (eg. http://de.example.com).
$prefix Optional path prefix for the language. Defaults to the language code if omitted.
$enabled Optionally TRUE to enable the language when created or FALSE to disable.
$default Optionally set this language to be the default.

locale_batch_by_component ( components,
finished = '_locale_batch_system_finished' 
)

Prepare a batch to run when installing modules or enabling themes. This batch will import translations for the newly added components in all the languages already set up on the site.

Parameters:
$components An array of component (theme and/or module) names to import translations for.
$finished Optional finished callback for the batch.

locale_batch_by_language ( langcode,
finished = NULL,
skip = array() 
)

Prepare a batch to import translations for all enabled modules in a given language.

Parameters:
$langcode Language code to import translations for.
$finished Optional finished callback for the batch.
$skip Array of component names to skip. Used in the installer for the second pass import, when most components are already imported.
Returns:
A batch structure or FALSE if no files found.

locale_languages_add_screen (  ) 

User interface for the language addition screen.

locale_languages_configure_form (  ) 

Setting for language negotiation options

locale_languages_configure_form_submit ( form,
&$  form_state 
)

Submit function for language negotiation settings.

locale_languages_custom_form (  ) 

Custom language addition form.

locale_languages_delete_form ( &$  form_state,
langcode 
)

User interface for the language deletion confirmation screen.

locale_languages_delete_form_submit ( form,
&$  form_state 
)

Process language deletion submissions.

locale_languages_edit_form ( &$  form_state,
langcode 
)

Editing screen for a particular language.

Parameters:
$langcode Language code of the language to edit.

locale_languages_edit_form_submit ( form,
&$  form_state 
)

Process the language editing form submission.

locale_languages_edit_form_validate ( form,
&$  form_state 
)

Validate the language editing form. Reused for custom language addition too.

locale_languages_overview_form (  ) 

User interface for the language overview screen.

locale_languages_overview_form_submit ( form,
&$  form_state 
)

Process language overview form submissions, updating existing languages.

locale_languages_predefined_form (  ) 

Predefined language setup form.

locale_languages_predefined_form_submit ( form,
&$  form_state 
)

Process the language addition form submission.

locale_languages_predefined_form_validate ( form,
&$  form_state 
)

Validate the language addition form.

locale_string_is_safe ( string  ) 

Check that a string is safe to be added or imported as a translation.

This test can be used to detect possibly bad translation strings. It should not have any false positives. But it is only a test, not a transformation, as it destroys valid HTML. We cannot reliably filter translation strings on inport becuase some strings are irreversibly corrupted. For example, a & in the translation would get encoded to & by filter_xss() before being put in the database, and thus would be displayed incorrectly.

The allowed tag list is like filter_xss_admin(), but omitting div and img as not needed for translation and likely to cause layout issues (div) or a possible attack vector (img).

locale_translate_delete_form ( &$  form_state,
source 
)

User interface for the string deletion confirmation screen.

locale_translate_delete_form_submit ( form,
&$  form_state 
)

Process string deletion submissions.

locale_translate_delete_page ( lid  ) 

String deletion confirmation page.

locale_translate_edit_form ( &$  form_state,
lid 
)

User interface for string editing.

locale_translate_edit_form_submit ( form,
&$  form_state 
)

Process string editing form submissions.

Saves all translations of one string submitted from a form.

locale_translate_edit_form_validate ( form,
&$  form_state 
)

Validate string editing form submissions.

locale_translate_export_po_form ( &$  form_state,
names 
)

Form to export PO files for the languages provided.

Parameters:
$names An associate array with localized language names

locale_translate_export_po_form_submit ( form,
&$  form_state 
)

Process a translation (or template) export form submission.

locale_translate_export_pot_form (  ) 

Translation template export form.

locale_translate_export_screen (  ) 

User interface for the translation export screen.

locale_translate_import_form (  ) 

User interface for the translation import screen.

locale_translate_import_form_submit ( form,
&$  form_state 
)

Process the locale import form submission.

locale_translate_overview_screen (  ) 

Overview screen for translations.

locale_translate_seek_form (  ) 

User interface for the string search screen.

locale_translate_seek_screen (  ) 

String search screen.