10000 [Translation] [Loader] Add INI_SCANNER_RAW to parse ini files by TeLiXj · Pull Request #10160 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Translation] [Loader] Add INI_SCANNER_RAW to parse ini files #10160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 1, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Translation] [Loader] Add INI_SCANNER_RAW to parse ini files
| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | no
| Fixed tickets | 
| License       | MIT
| Doc PR        | 

INI_SCANNER_RAW change the default scanner mode of parse_ini_files to parse all values without evaluate. This allow values with single quotes, "no" and "false" and raise an error if you use the deprecated "#" as comment character.
This change is specially good for shared translations, because a translator haven't to know that he can't use a few restricted terms.
And has a residual improvement: it's twice fast that use the default value (INI_SCANNER_NORMAL) in my tests
  • Loading branch information
TeLiXj committed Jan 29, 2014
commit 5ef60f14945f31e2805ed3fede5c775b54d2e758
2 changes: 1 addition & 1 deletion src/Symfony/Component/Translation/Loader/IniFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function load($resource, $locale, $domain = 'messages')
throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource));
}

$messages = parse_ini_file($resource, true);
$messages = parse_ini_file($resource, true, INI_SCANNER_RAW);

$catalogue = parent::load($messages, $locale, $domain);
$catalogue->addResource(new FileResource($resource));
Expand Down
0