class Gettext (View source)

Static class providing Drupal specific Gettext functionality.

The operations are related to pumping data from a source to a destination, for example:

  • Remote files http://*.po to memory
  • File public://*.po to database

Methods

static array
fileToDatabase(object $file, array $options)

Reads the given PO files into the database.

Details

static array fileToDatabase(object $file, array $options)

Reads the given PO files into the database.

Parameters

object $file

File object with an URI property pointing at the file's path.

  • "langcode": The language the strings will be added to.
  • "uri": File URI.
array $options

An array with options that can have the following elements:

  • 'overwrite_options': Overwrite options array as defined in Drupal\locale\PoDatabaseWriter. Optional, defaults to an empty array.
  • 'customized': Flag indicating whether the strings imported from $file are customized translations or come from a community source. Use LOCALE_CUSTOMIZED or LOCALE_NOT_CUSTOMIZED. Optional, defaults to LOCALE_NOT_CUSTOMIZED.
  • 'seek': Specifies from which position in the file should the reader start reading the next items. Optional, defaults to 0.
  • 'items': Specifies the number of items to read. Optional, defaults to -1, which means that all the items from the stream will be read.

Return Value

array

Report array as defined in Drupal\locale\PoDatabaseWriter.

See also

PoDatabaseWriter