Git Product home page Git Product logo

Comments (35)

manogi avatar manogi commented on May 30, 2024 1

Reported it here.

from oc-twigextensions-plugin.

vojtasvoboda avatar vojtasvoboda commented on May 30, 2024 1

Thanks!

from oc-twigextensions-plugin.

vojtasvoboda avatar vojtasvoboda commented on May 30, 2024

But last time (#8) you fixed it, don't you?

from oc-twigextensions-plugin.

manogi avatar manogi commented on May 30, 2024

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.

vojtasvoboda avatar vojtasvoboda commented on May 30, 2024

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.

manogi avatar manogi commented on May 30, 2024

You are right, when I think about it - it should actually just take the plural version.

from oc-twigextensions-plugin.

manogi avatar manogi commented on May 30, 2024

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.

vojtasvoboda avatar vojtasvoboda commented on May 30, 2024

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.

ribsousa avatar ribsousa commented on May 30, 2024

I have not tested yet if the problem only occurs with pt-br, I will enable German to verify this

from oc-twigextensions-plugin.

ribsousa avatar ribsousa commented on May 30, 2024

'timezone' => 'UTC',
In German returned the same result as English

The problem then is in pt-br?

from oc-twigextensions-plugin.

ribsousa avatar ribsousa commented on May 30, 2024

See! site change language

from oc-twigextensions-plugin.

vojtasvoboda avatar vojtasvoboda commented on May 30, 2024

Which is the official timezone for PT-BR? Is it same like English and German?

from oc-twigextensions-plugin.

ribsousa avatar ribsousa commented on May 30, 2024

No, Time Zone Brazil

from oc-twigextensions-plugin.

vojtasvoboda avatar vojtasvoboda commented on May 30, 2024

And when you set CMS timezone to Brazil, it prints correct translation?

from oc-twigextensions-plugin.

ribsousa avatar ribsousa commented on May 30, 2024

set 'timezone' => 'Brazil/East',
en/de print ok! 22 hours ago
pt-br print 1 hour ago

from oc-twigextensions-plugin.

manogi avatar manogi commented on May 30, 2024

Maybe we should have a look at the actual lang/pt-br/lang.php file in use here...

from oc-twigextensions-plugin.

ribsousa avatar ribsousa commented on May 30, 2024

You can check the result here

from oc-twigextensions-plugin.

vojtasvoboda avatar vojtasvoboda commented on May 30, 2024

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.

manogi avatar manogi commented on May 30, 2024

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.

ribsousa avatar ribsousa commented on May 30, 2024

October clean install!

from oc-twigextensions-plugin.

vojtasvoboda avatar vojtasvoboda commented on May 30, 2024

Which build? Try to enable edgeUpdates at config.

from oc-twigextensions-plugin.

manogi avatar manogi commented on May 30, 2024

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.

manogi avatar manogi commented on May 30, 2024

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.

manogi avatar manogi commented on May 30, 2024

We are getting closer: if I rename "pt-br" to "pt" and use that, it works correctly.

from oc-twigextensions-plugin.

ribsousa avatar ribsousa commented on May 30, 2024

pt is Portuguese from Portugal

from oc-twigextensions-plugin.

manogi avatar manogi commented on May 30, 2024

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.

ribsousa avatar ribsousa commented on May 30, 2024

ok!

from oc-twigextensions-plugin.

manogi avatar manogi commented on May 30, 2024

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.

vojtasvoboda avatar vojtasvoboda commented on May 30, 2024

This is weird, OctoberCMS uses also pt-br:

With pt_br it will not be compatible with OctoberCMS locale settings.

from oc-twigextensions-plugin.

manogi avatar manogi commented on May 30, 2024

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.

manogi avatar manogi commented on May 30, 2024

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.

vojtasvoboda avatar vojtasvoboda commented on May 30, 2024

And can you report this behaviour directly to the October repository and mention this thread? I'm curious about solution :-)

from oc-twigextensions-plugin.

ribsousa avatar ribsousa commented on May 30, 2024

+1

from oc-twigextensions-plugin.

ribsousa avatar ribsousa commented on May 30, 2024

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.

vojtasvoboda avatar vojtasvoboda commented on May 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.