You are here

public static function SmartyPants::i18nQuotes in Typogrify 8

Returns a locale-specific array of quotes.

Parameters

string $langcode: Optional. The language code, such as 'en' or 'fr', or the special string 'all'.

Return value

array If $langcode is a recognized language code, return string[] the opening and closing quote characters. If $langcode is NULL or an unrecognized code, return string[] the opening and closing quote characters for English. If $langcode is 'all', return string[][] an array of such arrays, keyed by the recognized language codes.

1 call to SmartyPants::i18nQuotes()
SmartyPants::process in src/SmartyPants.php
SmartyPants.

File

src/SmartyPants.php, line 85

Class

SmartyPants
SmartyPants - Smart punctuation for web sites.

Namespace

Drupal\typogrify

Code

public static function i18nQuotes($langcode = NULL) {

  // Ignore all english-equivalents served by fallback.
  $quotes = [
    // Arabic.
    'ar' => [
      '«',
      '»',
      '‹',
      '›',
    ],
    // Belarusian.
    'be' => [
      '«',
      '»',
      '„',
      '“',
    ],
    // Bulgarian.
    'bg' => [
      '„',
      '“',
      '‚',
      '‘',
    ],
    // Danish.
    'da' => [
      '»',
      '«',
      '›',
      '‹',
    ],
    // German.
    'de' => [
      '„',
      '“',
      '‚',
      '‘',
    ],
    // Greek.
    'el' => [
      '«',
      '»',
      '‹',
      '›',
    ],
    // English.
    'en' => [
      '“',
      '”',
      '‘',
      '’',
    ],
    // Esperanto.
    'eo' => [
      '“',
      '”',
      '“',
      '”',
    ],
    // Spanish.
    'es' => [
      '«',
      '»',
      '“',
      '“',
    ],
    // Estonian.
    'et' => [
      '„',
      '“',
      '„',
      '“',
    ],
    // Finnish.
    'fi' => [
      '”',
      '”',
      '’',
      '’',
    ],
    // French.
    'fr' => [
      '«',
      '»',
      '‹',
      '›',
    ],
    // Swiss German.
    'gsw-berne' => [
      '„',
      '“',
      '‚',
      '‘',
    ],
    // Hebrew.
    'he' => [
      '“',
      '“',
      '«',
      '»',
    ],
    // Croatian.
    'hr' => [
      '»',
      '«',
      '›',
      '‹',
    ],
    // Hungarian.
    'hu' => [
      '„',
      '“',
      '„',
      '“',
    ],
    // Icelandic.
    'is' => [
      '„',
      '“',
      '‚',
      '‘',
    ],
    // Italian.
    'it' => [
      '«',
      '»',
      '‘',
      '’',
    ],
    // Lithuanian.
    'lt' => [
      '„',
      '“',
      '‚',
      '‘',
    ],
    // Latvian.
    'lv' => [
      '„',
      '“',
      '„',
      '“',
    ],
    // Dutch.
    'nl' => [
      '„',
      '”',
      '‘',
      '’',
    ],
    // Norwegian.
    'no' => [
      '„',
      '“',
      '„',
      '“',
    ],
    // Polish.
    'pl' => [
      '„',
      '”',
      '«',
      '»',
    ],
    // Portuguese.
    'pt' => [
      '“',
      '”',
      '‘',
      '’',
    ],
    // Romanian.
    'ro' => [
      '„',
      '“',
      '«',
      '»',
    ],
    // Russian.
    'ru' => [
      '«',
      '»',
      '„',
      '“',
    ],
    // Slovak.
    'sk' => [
      '„',
      '“',
      '‚',
      '‘',
    ],
    // Slovenian.
    'sl' => [
      '„',
      '“',
      '‚',
      '‘',
    ],
    // Albanian.
    'sq' => [
      '«',
      '»',
      '‹',
      '›',
    ],
    // Serbian.
    'sr' => [
      '„',
      '“',
      '‚',
      '‘',
    ],
    // Swedish.
    'sv' => [
      '”',
      '”',
      '’',
      '’',
    ],
    // Turkish.
    'tr' => [
      '«',
      '»',
      '‹',
      '›',
    ],
    // Ukrainian.
    'uk' => [
      '«',
      '»',
      '„',
      '“',
    ],
  ];
  if ($langcode == 'all') {
    return $quotes;
  }
  if (isset($quotes[$langcode])) {
    return $quotes[$langcode];
  }
  return $quotes['en'];
}