Skip to content
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

Feature/extract concat strings #379

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

murhafh
Copy link

@murhafh murhafh commented Jul 29, 2016

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #296
License Apache2

Description

Just added a small change so in case you have a long concatenated strings in your code, you can use the bundle to extract those strings into your translation files. It basically converts the concatenated strings into one string before passing it to extraction.

Todos

  • Tests
  • Documentation
  • Changelog

@murhafh
Copy link
Author

murhafh commented Jul 29, 2016

This is replacing #336

I'm not sure about the part "It only adds the ability to handle concatenated strings to regular php files. Is it not possible to support this with other files like the form extractor?"

I haven't used that feature but I can add the fix there too, I would need some details though on where to add the fix, is it only affecting FormExtractor class? Or it should be added in other places too?

@@ -216,7 +216,7 @@ public function extract()
if (false !== $pos = strrpos($file, '.')) {
$extension = substr($file, $pos + 1);

if ('php' === $extension) {
if ('php' === $extension or 'phtml' === $extension) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this needed?

@Nyholm
Copy link
Collaborator

Nyholm commented Aug 4, 2016

I like this PR, I only had some questions

if ($node instanceof String_) {
return $node->value;
} else {
return self::concatToString($node->left) . self::concatToString($node->right);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why a static call?

@ABM-Dan
Copy link
Contributor

ABM-Dan commented Aug 10, 2016

ping @murhafh, you still looking to get this merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants