Back to LanguageHelper class

Method saveToIniFile

public static bool
saveToIniFile
(mixed $fileName, array $strings)
Save strings to a language file.
Parameters
  • string $fileName The language ini file path.
  • array $strings The array of strings.
Returns
  • bool True if saved, false otherwise.
Since
  • 3.7.0

Method saveToIniFile - Source code

/**
 * Save strings to a language file.
 *
 * @param   string  $fileName  The language ini file path.
 * @param   array   $strings   The array of strings.
 *
 * @return  boolean  True if saved, false otherwise.
 *
 * @since   3.7.0
 */
public static function saveToIniFile($fileName, array $strings)
{
    // Escape double quotes.
    foreach ($strings as $key => $string) {
        $strings[$key] = addcslashes($string, '"');
    }
    // Write override.ini file with the strings.
    $registry = new Registry($strings);
    return File::write($fileName, $registry->toString('INI'));
}