Closed ribsousa closed 6 years ago
But last time (https://github.com/vojtasvoboda/oc-twigextensions-plugin/issues/8) you fixed it, don't you?
If I may interrupt - there is something wrong in the pt-br language files. I made the same mistake in the German ones. Only the plural versions have had a placeholder. I just created a pull request to fix that.
Thanks @manogi it may be solution. @ribsousa can you please test it on your website?
But it's weird, first section should be for singular version.
You are right, when I think about it - it should actually just take the plural version.
I'm sorry, my comment was wrong - the English files also just have the "1" and no placeholder, and that is perfectly fine like that. So the issue must lie somewhere else.
And when you have sites in en and de locale, do they have same results? For example when you can see in English "1 hour ago", do you see same in German one?
I have not tested yet if the problem only occurs with pt-br, I will enable German to verify this
'timezone' => 'UTC', In German returned the same result as English
The problem then is in pt-br?
Which is the official timezone for PT-BR? Is it same like English and German?
No, Time Zone Brazil
And when you set CMS timezone to Brazil, it prints correct translation?
set 'timezone' => 'Brazil/East', en/de print ok! 22 hours ago pt-br print 1 hour ago
Maybe we should have a look at the actual lang/pt-br/lang.php file in use here...
I don't really know. The translations are taken from https://github.com/KnpLabs/KnpTimeBundle/tree/master/Resources/translations so they should be fine.
This plugin only connect October Translator with Twig Extensions plugin. It doesn't modify the data in any way, so I'm not sure. Maybe the problem is in Twig Extensions.
It seems it always takes the singular version instead of the plural version.
The lang file in your repository looks fine. But maybe @ribsousa isn't really using that version? Is that an OctoberCMS installation or something else?
October clean install!
Which build? Try to enable edgeUpdates
at config.
I just tested this in one of my websites - I have the same problems with pt-br. But now can tweak the files and test better...
If I replace the complete content of pt-br with the en lang file, I still get the same wrong results
We are getting closer: if I rename "pt-br" to "pt" and use that, it works correctly.
pt is Portuguese from Portugal
I know - this is not about that, but about the fact that probably the "-" in the folder name is a problem. I could also have renamed it to "xy".
ok!
An underscore also works: renaming the folder to "pt_br" also had good results. I will prepare a pull request. I guess @vojtasvoboda will merge it and put it on the market place.
Just make sure that after updating the twig extensions plugin you go directly to your language settings in octoberCMS and replace "pt-br" with "pt_br". And the css class of your flag to "flag-icon-pt_br" ;-)
This is weird, OctoberCMS uses also pt-br
:
With pt_br
it will not be compatible with OctoberCMS locale settings.
Ah ok - closed my pull request. But then I'm out of my depth here and you need to take over ;-)
Maybe the knowledge that it works without the dash in the folder name helps a little.
OK found it - but it is unfortunately a problem with OctoberCMS. It makes use of this class But have a look at line 38: it checks if the locale name is longer than 3 characters and then tries to split it at the "_" sign. After that, the locale is basically empty, and the translation falls back to taking the first part of the string in your translation file. So OctoberCMS also should not be using "pt-br" and so on. But it probably never caused problems, because none of these files seem to use the singular/plural version of translation files...
And can you report this behaviour directly to the October repository and mention this thread? I'm curious about solution :-)
+1
Actually renaming the folder to pt_br and changing the language setting to pt_br, it works. However octobercms uses pt-br; the problem seems to be even the "-" as reported by manogi.
I'll wait for @manogi and his Issue to the OctoberCMS repo and we'll see where is the problem.
Reported it here.
Thanks!
I'm having a problem with multi language site!
exemple: post published in 12/1/2017 09:25
Locale set to en works fine! print correct 12 hours ago
When I change language to pt-br not work! print worong 1 hora atrás
'timezone' => 'UTC',