Comments (35)
Reported it here.
from oc-twigextensions-plugin.
Thanks!
from oc-twigextensions-plugin.
But last time (#8) you fixed it, don't you?
from oc-twigextensions-plugin.
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.
from oc-twigextensions-plugin.
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.
from oc-twigextensions-plugin.
You are right, when I think about it - it should actually just take the plural version.
from oc-twigextensions-plugin.
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.
from oc-twigextensions-plugin.
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?
from oc-twigextensions-plugin.
I have not tested yet if the problem only occurs with pt-br, I will enable German to verify this
from oc-twigextensions-plugin.
'timezone' => 'UTC',
In German returned the same result as English
The problem then is in pt-br?
from oc-twigextensions-plugin.
See! site change language
from oc-twigextensions-plugin.
Which is the official timezone for PT-BR? Is it same like English and German?
from oc-twigextensions-plugin.
No, Time Zone Brazil
from oc-twigextensions-plugin.
And when you set CMS timezone to Brazil, it prints correct translation?
from oc-twigextensions-plugin.
set 'timezone' => 'Brazil/East',
en/de print ok! 22 hours ago
pt-br print 1 hour ago
from oc-twigextensions-plugin.
Maybe we should have a look at the actual lang/pt-br/lang.php file in use here...
from oc-twigextensions-plugin.
You can check the result here
from oc-twigextensions-plugin.
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.
from oc-twigextensions-plugin.
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?
from oc-twigextensions-plugin.
October clean install!
from oc-twigextensions-plugin.
Which build? Try to enable edgeUpdates
at config.
from oc-twigextensions-plugin.
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...
from oc-twigextensions-plugin.
If I replace the complete content of pt-br with the en lang file, I still get the same wrong results
from oc-twigextensions-plugin.
We are getting closer: if I rename "pt-br" to "pt" and use that, it works correctly.
from oc-twigextensions-plugin.
pt is Portuguese from Portugal
from oc-twigextensions-plugin.
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".
from oc-twigextensions-plugin.
ok!
from oc-twigextensions-plugin.
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" ;-)
from oc-twigextensions-plugin.
This is weird, OctoberCMS uses also pt-br
:
- https://github.com/octobercms/october/tree/master/modules/backend/lang
- https://github.com/octobercms/october/tree/master/modules/cms/lang
- https://github.com/octobercms/october/tree/master/modules/system/lang
With pt_br
it will not be compatible with OctoberCMS locale settings.
from oc-twigextensions-plugin.
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.
from oc-twigextensions-plugin.
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...
from oc-twigextensions-plugin.
And can you report this behaviour directly to the October repository and mention this thread? I'm curious about solution :-)
from oc-twigextensions-plugin.
+1
from oc-twigextensions-plugin.
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.
from oc-twigextensions-plugin.
I'll wait for @manogi and his Issue to the OctoberCMS repo and we'll see where is the problem.
from oc-twigextensions-plugin.
Related Issues (20)
- Translations sets days months and year with value 1 HOT 1
- base64_encode/decode (enhancement) HOT 1
- Having trouble with the Arabic language HOT 6
- Custom plugin and custom lang.php file HOT 1
- ucfirst filter has wrong behavior.
- Plugin update error HOT 2
- Group By function? HOT 5
- Class 'Twig_Extensions_Extension_Text' not found with OctoberCMS v1.1.1 HOT 5
- Plugin prevents password retrieval HOT 1
- mode-js.js for October plugin - Twig Extensions (I think) HOT 1
- "Target class [twig.environment] does not exist" while running phpunit HOT 1
- Class "Twig_Extension_StringLoader" not found HOT 14
- New version won't update HOT 9
- october 3.x HOT 3
- Struggling to update to latest version HOT 7
- October CMS v3.1 - Upgrade Guide HOT 5
- Incompatible with October v3.0 HOT 4
- Class "IntlDateFormatter" not found HOT 9
- Error with format_datetime() HOT 9
- Unknown "truncate" filter. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oc-twigextensions-plugin.