Comments (24)
@qroft New file should have path /plugins/vojtasvoboda/twigextensions/lang/es/lang.php
and then websites should be switched to es
locale.
from oc-twigextensions-plugin.
Thanks @ribsousa, good point. I tried to follow the Twig documentation:
To get a translatable output, give a Symfony\Component\Translation\TranslatorInterface as constructor argument. The returned string is formatted as diff.ago.XXX or diff.in.XXX where XXX can be any valid unit: second, minute, hour, day, month, year.
But it returns string like diff.ago.minute
instead of 5 minutes ago
, so I have to figure out how to translate this strings. Because when I create plugin's translations, they will be prefixed with vojtasvoboda.twigextensions
:-(
from oc-twigextensions-plugin.
Hello, take a look at this! I think it's the way to get the translation
http://stackoverflow.com/questions/34568838/twig-date-time-diff-translation/34569701
https://github.com/KnpLabs/KnpTimeBundle/blob/master/Resources/translations/time.en.xliff
from oc-twigextensions-plugin.
Hello @ribsousa,
this KnpTimeBundle is bundle created for Symfony and using Symfony Translator. For this plugin it will be better to use October Translator and have all translations stored at /lang
folder.
Check my feature/time_diff_trans
branch with translations testing version. Can you please test it?
Translate string are stored at /lang/en/lang.php and they are taken from https://github.com/KnpLabs/KnpTimeBundle/blob/master/Resources/translations/time.en.xliff
from oc-twigextensions-plugin.
How to install it via composer?
from oc-twigextensions-plugin.
Go to the /plugins/vojtasvoboda/
directory and run git clone [email protected]:vojtasvoboda/oc-twigextensions-plugin.git -b feature/time_diff_trans twigextensions
from oc-twigextensions-plugin.
from oc-twigextensions-plugin.
Just download it to /plugins/vojtasvoboda/twigextensions/
folder. Nothing more.
from oc-twigextensions-plugin.
from oc-twigextensions-plugin.
I'm sorry, you have to run composer install
at /plugins/vojtasvoboda/twigextensions/
from oc-twigextensions-plugin.
from oc-twigextensions-plugin.
Can you send me your translation file please? I can see you don't use english nor czech translations. I want to add it to repository for others, thanks.
from oc-twigextensions-plugin.
from oc-twigextensions-plugin.
There is a problem with filter!
example:
Post published on Dec 08, 2016
{{ post.published_at | time_diff }}
return: 1 day ago
from oc-twigextensions-plugin.
I have tried
{{ '2016-12-08 12:00' | time_diff }}
and it prints
1 month ago
My timezone is set to UTC.
from oc-twigextensions-plugin.
Fixed by #16
from oc-twigextensions-plugin.
{{ '2016-12-08 12:00' | time_diff }}
Here also print
1 month ago
But the date of the post "8-12-2016 14:31"
{{ post.published_at | time_diff }}
en print: 30 days ago
pt-br print: 1 dias atrás
My timezone is set to America/Brasilia
from oc-twigextensions-plugin.
It's working right now printing correctly!
from oc-twigextensions-plugin.
Update is now ready at the October Market. Can you send me please that pt-br
locale file by pull-request? Thanks
from oc-twigextensions-plugin.
@ribsousa: I would like to ask you, can you give me review to the Twig plugin please? It really helps me :-) Thanks!
http://octobercms.com/plugin/vojtasvoboda-twigextensions
from oc-twigextensions-plugin.
from oc-twigextensions-plugin.
Hey sorry for the bump, but can't find feature/time_diff_trans branch. I'm little confused about how to give a Symfony\Component\Translation\TranslatorInterface as the constructor argument.
from oc-twigextensions-plugin.
@HackHers Time_diff_trans branch was merged in this pull request: #16
from oc-twigextensions-plugin.
I am also having some trouble with this as i am unsure if i have to create the LANG folder in the root or simply just add my language into the plugins folder at twigextenstions/lang !?
What i did:
i downloaded the EN language folder and edited its language into spanish.
Then i uploaded it to the plugins lang folder into a folder "es" for spanish.
Did not work.
So i renamed it to "es_es" - did not work.
So i renamed it to "es-ES" - did also not work.
I know that translations are working, as i am using the localizeddate tag somewhere else and there it works perfectly.
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.