-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Translation of text with spaces is taken from messages.local.neon #26
Comments
If message contain dot and space, translator use message domain by default. Its expected behaviour. Try this: |
Thanks but it doesn't help. Tracy said that this translation is missing:
It's in form:
And lang file is applicationModule.cs_CZ.neon:
Result of this in html is: So I don't realy know why is my translation domain ignored.... |
Code bellow works for me: $translator->setPrefix(['a']);
var_dump($translator->translate('Ahoj jak se mas:', [], 'my_domain')); a:
Ahoj jak se mas:: "hmm"
|
Ok, and in your example, neon file with translation has name messages.cs_CZ.neon? If yes, it works and its correct. But in my case I need to have translation file named according to domain name. In next example is translator still looking for translation into messages.cs_CZ.neon:
applicationModule.cs_CZ.neon:
And I think that reason is in Helpers.php:
Reason is directly in first line with condition. Because exploding string by '.' is done only if $messsage don't contain space.
And in my message is space, so domain is automaticly given
Is there some reason to have this part of condition ? Wouldn't be better only this ?
Thanks for your help! :-) |
My code works for every domain name, look on third parameter. If you set domain in parameter, extract message will be skip -> this is solution for you. But no idea why strpos($message, ' ') === false is used. You can try send PR with solution without BC breaks. |
ok I will send PR. Thanks |
@TomasHalasz can you try "space" branch? |
I've issue with translation of text with spaces. For example
$translator->translate('Kočka leze dírou, pes oknem');
is looking for string "Kočka leze dírou, pes oknem" in default messages.local.neon even if I hade set different domain by$translator->setPrefix(['customModule.status']);
I don't know if it is error or behavior by design.My idea is to replace spaces with underscores in messages, because it's still readable in case of missing translate in neon.
And the best way in my opinion is in Translator.php :
Nice would be if user can set on or off this replacing space by underscore. What do you think?
The text was updated successfully, but these errors were encountered: