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

"Missing translation" annotation shown even though key is known #195

Closed
luzat opened this issue Dec 11, 2013 · 7 comments
Closed

"Missing translation" annotation shown even though key is known #195

luzat opened this issue Dec 11, 2013 · 7 comments
Labels

Comments

@luzat
Copy link

luzat commented Dec 11, 2013

When using code such as $translator->trans(...) autocompletion works for keys, but keys are always being annotated with "Missing translation". Clearing Symfony and PhpStorm caches did not help.

Additionally, keys with interpolated variables (such as "foo$bar") are being annotated with "Missing translation", even though this probably does not make much sense.

The project is based on Symfony 2.4.0, one translation file in src/Foo/BarBundle/Resources/translations/messages.de.xliff and the files catalogue.de.php and catalogue.de.php.meta being generated in app/cache/dev/translations Are additional translations (e.g. en) needed or any further configuration?

The platform is PhpStorm 133.214 with Symfony 2 plugin 0.10.34 (if I recall correctly the same happened for all previous versions that were installed).

@Haehnchen
Copy link
Owner

should be fixed.
if key of xliff is inside translation file. pls check in next release.
"$" is know not a valid translation key

@luzat
Copy link
Author

luzat commented Dec 19, 2013

$translator->trans("$foo"); does no longer give "Missing translation" in 0.10.35 for me, but $translator->trans('some.valid.key'); always does for me. I suppose it should work in general, but does not for some reason in my project (even though completion of those keys works). Maybe some issue with the default locale? I am unsure what other details I can provide to aid in debugging, though.

@Haehnchen
Copy link
Owner

there is atleast some logging in "Help > Show log in explorer?" > log.txt.

currently there first matched file in translation fodler is used for extract (with regular expressions :( ) the keys. in generally every file should hold every key. can u pls search in translation folder for the not working key?

i also need to invest some time to make it more stable in non commen use cases

@luzat
Copy link
Author

luzat commented Dec 20, 2013

grep shows the keys in messages.de.xliff and catalogue.de.php. The log is quite boring. Is there any Open Source project for which the "Missing translation" annotation works correctly and which I could compare to mine?

@Haehnchen
Copy link
Owner

can you recheck on latest release?

@luzat
Copy link
Author

luzat commented Dec 30, 2013

With PhpStorm 7.1 and Symfony Plugin 0.10.37 I do get:

  1. $this->trans('foo.bar'); // missing translation (but messages.de.xliff defines foo.bar)
  2. $this->trans("foo.bar"); // same
  3. $this->trans("$foo.bar"); // no missing translation; that's okay.
  4. $this->trans('$foo.bar'); // no missing translation (but messages.de.xliff does not define $foo.bar)

The behavior for 4. is not really that important, but 1.+2. really shouldn't show missing translation (completing 'foo.bar' still works). I still don't know why the plugin thinks that the translations are missing. Does it try to check multiple files? My project doesn't contain any other translations and de is the default.

@Haehnchen
Copy link
Owner

i did a complete translation rewrite today. so we dont need the compiled file at all. if you need an example checkout http://www.orocrm.com. its my test case

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

No branches or pull requests

2 participants