You are here

function fckeditor_load_lang_options in FCKeditor - WYSIWYG HTML editor 5.2

Same name and namespace in other branches
  1. 6.2 fckeditor.lib.inc \fckeditor_load_lang_options()
  2. 6 fckeditor.module \fckeditor_load_lang_options()
2 calls to fckeditor_load_lang_options()
fckeditor_profile_form_build in ./fckeditor.module
Return an HTML form for profile configuration.
fckeditor_user in ./fckeditor.module
Implementation of hook_user().

File

./fckeditor.module, line 1376
FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2007 Frederico Caldeira Knabben

Code

function fckeditor_load_lang_options() {
  $arr = array();
  $module_drupal_path = drupal_get_path('module', 'fckeditor');
  $lang_dir = $module_drupal_path . '/fckeditor/editor/lang';
  if (is_dir($lang_dir)) {
    $dh = @opendir($lang_dir);
    if (FALSE !== $dh) {
      while (($file = readdir($dh)) !== FALSE) {
        if (in_array($file, array(
          ".",
          "..",
          "CVS",
          ".svn",
        ))) {
          continue;
        }
        if (is_file($lang_dir . DIRECTORY_SEPARATOR . $file) && preg_match("/^(.*?)\\.js\$/", $file, $matches)) {
          $lang = $matches[1];
          $arr[$lang] = strtoupper($lang);
        }
      }
      closedir($dh);
    }
  }

  //oops, we have no information about languages, let's use those available in FCKeditor 2.4.3
  if (empty($arr)) {
    $arr = array(
      'af' => 'Afrikaans',
      'ar' => 'Arabic',
      'bg' => 'Bulgarian',
      'bn' => 'Bengali/Bangla',
      'bs' => 'Bosnian',
      'ca' => 'Catalan',
      'cs' => 'Czech',
      'da' => 'Danish',
      'de' => 'German',
      'el' => 'Greek',
      'en' => 'English',
      'en-au' => 'English (Australia)',
      'en-ca' => 'English (Canadian)',
      'en-uk' => 'English (United Kingdom)',
      'eo' => 'Esperanto',
      'es' => 'Spanish',
      'et' => 'Estonian',
      'eu' => 'Basque',
      'fa' => 'Persian',
      'fi' => 'Finnish',
      'fo' => 'Faroese',
      'fr' => 'French',
      'gl' => 'Galician',
      'he' => 'Hebrew',
      'hi' => 'Hindi',
      'hr' => 'Croatian',
      'hu' => 'Hungarian',
      'it' => 'Italian',
      'ja' => 'Japanese',
      'km' => 'Khmer',
      'ko' => 'Korean',
      'lt' => 'Lithuanian',
      'lv' => 'Latvian',
      'mn' => 'Mongolian',
      'ms' => 'Malay',
      'nb' => 'Norwegian Bokmal',
      'nl' => 'Dutch',
      'no' => 'Norwegian',
      'pl' => 'Polish',
      'pt' => 'Portuguese (Portugal)',
      'pt-br' => 'Portuguese (Brazil)',
      'ro' => 'Romanian',
      'ru' => 'Russian',
      'sk' => 'Slovak',
      'sl' => 'Slovenian',
      'sr' => 'Serbian (Cyrillic)',
      'sr-latn' => 'Serbian (Latin)',
      'sv' => 'Swedish',
      'th' => 'Thai',
      'tr' => 'Turkish',
      'uk' => 'Ukrainian',
      'vi' => 'Vietnamese',
      'zh' => 'Chinese Traditional',
      'zh-cn' => 'Chinese Simplified',
    );
  }
  asort($arr);
  return $arr;
}