You are here

static function Helpers::calendar_systems_add_strings in Calendar Systems 8.2

1 call to Helpers::calendar_systems_add_strings()
AdminSettings::buildForm in src/Form/AdminSettings.php
Form constructor.

File

src/Helpers.php, line 127
Contains \Drupal\calendar_systems.

Class

Helpers

Namespace

Drupal\calendar_systems

Code

static function calendar_systems_add_strings() {
  $calendar = Calendar::factory('v1', array());
  $stringGroups = $calendar
    ->getAllStrings();
  foreach ($stringGroups as $stringGroupName => $stringGroup) {
    foreach ($stringGroup as $langcode => $strings) {
      foreach ($strings as $string) {
        $options = array(
          'langcode' => $langcode,
        );
        if ($stringGroupName == 'monthsName') {
          $options['context'] = 'Long month name';
        }
        if ($stringGroupName == 'weeksShortName') {
          $options['context'] = 'Week short name';
        }
        $val = t($string, array(), $options);
      }
    }
  }
}