/**
  * parse a dictionary-file to create an ini-file from it.
  *
  * @param string $locale Parse the file for the given locale
  *
  * @throws \Org\Heigl\Hyphenator\Exception\PathNotFoundException
  * @return string
  */
 public static function parseFile($locale)
 {
     $path = self::$_fileLocation . DIRECTORY_SEPARATOR;
     $file = $path . 'hyph_' . $locale . '.dic';
     if (!file_Exists($file)) {
         throw new \Org\Heigl\Hyphenator\Exception\PathNotFoundException('The given Path does not exist');
     }
     $items = file($file);
     $source = trim($items[0]);
     if (0 === strpos($source, 'ISO8859')) {
         $source = str_Replace('ISO8859', 'ISO-8859', $source);
     }
     unset($items[0]);
     $fh = fopen($path . $locale . '.ini', 'w+');
     foreach ($items as $item) {
         // Remove comment-lines starting with '#' or '%'.
         if (in_array(mb_substr($item, 0, 1), array('#', '%'))) {
             continue;
         }
         // Ignore empty lines.
         if ('' == trim($item)) {
             continue;
         }
         // Remove all Upper-case items as they are OOo-specific
         if ($item === mb_strtoupper($item)) {
             continue;
         }
         // Ignore lines containing an '=' sign as these are specific
         // instructions for non-standard-hyphenations. These will be
         // implemented later.
         if (false !== mb_strpos($item, '=')) {
             continue;
         }
         $item = mb_convert_Encoding($item, 'UTF-8', $source);
         $result = Pattern::factory($item);
         $string = '@:' . $result->getText() . ' = "' . $result->getPattern() . '"' . "\n";
         fwrite($fh, $string);
     }
     fclose($fh);
     return $path . $locale . '.ini';
 }