Thanks to visit codestin.com
Credit goes to github.com

Skip to content

trim placeholder to remove whitespaces #7056

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

Closed
wants to merge 1 commit into from
Closed

trim placeholder to remove whitespaces #7056

wants to merge 1 commit into from

Conversation

smashi
Copy link

@smashi smashi commented Feb 12, 2013

Just another try to explain why my changes are required ;-)

in the template we can write {% trans %}placeholder{% endtrans %} or {% trans %} placeholder {% endtrans %}
it would both match witch the string 'placeholder' in the translation file

when we call the console script translation:update the first would be created to 'placeholder' and the second to ' placeholder ', which are two different values, but the first one is correct and work with both trans tags.

@@ -77,7 +77,8 @@ protected function extractTemplate($template, MessageCatalogue $catalogue)
$this->twig->parse($this->twig->tokenize($template));

foreach ($visitor->getMessages() as $message) {
$catalogue->set($message[0], $this->prefix.$message[0], $message[1] ? $message[1] : $this->defaultDomain);
$placeholder = trim($message[0]);
$catalogue->set($placeholder, $this->prefix.$placeholder, $message[1] ? $message[1] : $this->defaultDomain);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just do $catalogue->set(trim($message[0]), .... Placeholder is not the best name anyway.

fabpot added a commit that referenced this pull request Feb 27, 2013
…e text in trans tags (closes #7056)

Trimming was not done by the extractor but it was the default behavior
of the TransNode class. Now, things are consistent between the two.
@fabpot fabpot closed this Feb 27, 2013
fabpot added a commit that referenced this pull request Mar 1, 2013
* 2.1:
  Options small typo
  [Console] fixed unparsed StringInput tokens
  [TwigBridge] fixed trans twig extractor
  [DomCrawler] fix handling of schemes by Link::getUri()
  [Console] Fixed comment
  [TwigBridge] fixed the translator extractor that were not trimming the text in trans tags (closes #7056)
  Fixed handling absent href attribute in base tag
  added a DebuClassLoader::findFile() method to make the wrapping less invasive
  fixed CHANGELOG
  bumped Symfony version to 2.1.9-DEV
  updated VERSION for 2.1.8
  updated CHANGELOG for 2.1.8
  StringInput resets the given options.

Conflicts:
	src/Symfony/Component/HttpKernel/Kernel.php
fabpot added a commit that referenced this pull request Mar 1, 2013
* 2.2: (24 commits)
  Options small typo
  [Console] fixed unparsed StringInput tokens
  Mask PHP_AUTH_PW header in profiler
  [TwigBridge] fixed trans twig extractor
  [Finder] adds adapter selection/unselection capabilities
  [DomCrawler] fix handling of schemes by Link::getUri()
  [Console] Fixed comment
  [TwigBridge] fixed the translator extractor that were not trimming the text in trans tags (closes #7056)
  Fixed handling absent href attribute in base tag
  fixed paths/notPaths regex for shell adapters
  fix issue 4911
  Adds expandable globs support to shell adapters
  [HttpFoundation] Fixed messed up headers
  Fixes AppCache + ESI + Stopwatch problem
  added a DebuClassLoader::findFile() method to make the wrapping less invasive
  bumped Symfony version to 2.2.0-RC4-DEV
  updated VERSION for 2.2.0-RC3
  updated CHANGELOG for 2.2.0-RC3
  fixed CHANGELOG
  bumped Symfony version to 2.1.9-DEV
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants