# |
Jun 5th 2021, 14:06 |
kevin.pfeifer |
or should cookie logic always be present in the controller? |
# |
Jun 5th 2021, 14:04 |
kevin.pfeifer |
is it possible to set a Cookie inside a beforeSave hook in the model? Currently I only find ways to set cookies via the request object which I can’t access in the model |
# |
Jun 5th 2021, 11:26 |
fresnel.brieuc |
Thank you so much ! Exactly what I needed :) |
# |
Jun 5th 2021, 11:24 |
slackebot |
contributor @markstory, • https://github.com/markstory/cakephp-typescript-react • https://github.com/markstory/docket-app Above projects are more than enough for you to get understanding I hope. |
# |
Jun 5th 2021, 11:24 |
isvyas |
Hi @fresnel.brieuc, there's one repo that I've created to demonstrate CakePHP3 + Vue. Currently vue.js version is 2 but general idea would be the same for vue3 or react. • CakePHP + Vue: https://github.com/ishanvyas22/cakephpvue-spa Above project uses https://github.com/ishanvyas22/asset-mix plugin which makes using modern frontend with CakePHP a breeze. There's also couple of projects for CakePHP + React from core CakePHP |
# |
Jun 5th 2021, 09:19 |
fresnel.brieuc |
Kinda new on making front-end and back-end frameworks together |
# |
Jun 5th 2021, 09:17 |
fresnel.brieuc |
Hello there. I'm trying to use Cake4 + Vue3 and I can't find many resources on how to integrate vue properly with cake. Right now I have to build my vue project and copy/paste the production build into Cake webroot... does any one know of a tutorial on a clean way to do this ? Maybe a tutorial on how to integrate a js framework into cake, if there's none about vue specifically ? |
# |
Jun 4th 2021, 19:40 |
kevin.pfeifer |
:+1: no problem |
# |
Jun 4th 2021, 19:40 |
aengblom |
Makes sense to me now! I am working on an existing application that already had this incorporated into it. I didn't fully understand it. Today came the day where I actually had to worry about translations, lol. Thank you so much for your help and kindness! |
# |
Jun 4th 2021, 19:38 |
kevin.pfeifer |
To explain what each file does: *default.pot* is basically just a template file for what can be translated in whatever language you desire *default.po* is the editable translation file for your desired language *default.mo* is the compiled translation file which cakephp actually reads |
# |
Jun 4th 2021, 19:37 |
aengblom |
Thank you, Kevin! This helps a ton! I think I understand it now. |
# |
Jun 4th 2021, 19:36 |
kevin.pfeifer |
so the process would be like 1. generate new `default.pot` file with `bin/cake extract` 2. update already present `default.po` (no t at the end!) with the new `default.pot` file via PoEdit 3. Translate your new strings 4. Save the `default.po` file so PoEdit generates a new `default.mo` 5. Check if strings are translated as you desire in your app 6. If not, do a `bin/cake cache clear_all` |
# |
Jun 4th 2021, 19:34 |
aengblom |
Ok, gotcha |
# |
Jun 4th 2021, 19:33 |
kevin.pfeifer |
which you then can translate |
# |
Jun 4th 2021, 19:33 |
kevin.pfeifer |
and now it should contain your new strings |
# |
Jun 4th 2021, 19:33 |
kevin.pfeifer |
then select the newly generated default.pot file |
# |
Jun 4th 2021, 19:33 |
kevin.pfeifer |
and select "Update from POT File" |
# |
Jun 4th 2021, 19:32 |
kevin.pfeifer |
then in the menu at top go to "Catalogue" |
# |
Jun 4th 2021, 19:32 |
aengblom |
ok |
# |
Jun 4th 2021, 19:32 |
kevin.pfeifer |
open that with poedit |
# |
Jun 4th 2021, 19:32 |
kevin.pfeifer |
ok good, so you have a default.po file |
# |
Jun 4th 2021, 19:32 |
aengblom |
yes, poedit |
# |
Jun 4th 2021, 19:31 |
kevin.pfeifer |
PoEdit? |
# |
Jun 4th 2021, 19:31 |
kevin.pfeifer |
with what file do you edit/translate your .po file |
# |
Jun 4th 2021, 19:31 |
kevin.pfeifer |
:) |
# |
Jun 4th 2021, 19:31 |
aengblom |
Ok, this is where I am fuzzy |
# |
Jun 4th 2021, 19:30 |
kevin.pfeifer |
and you updated your .po file in your language with that new .pot file |
# |
Jun 4th 2021, 19:30 |
aengblom |
Yep |
# |
Jun 4th 2021, 19:29 |
kevin.pfeifer |
and inside your .pot file does the file/line also appear in the comments for that string? |
# |
Jun 4th 2021, 19:28 |
aengblom |
Yep, I did the extract command |
# |
Jun 4th 2021, 19:27 |
kevin.pfeifer |
do you generate your `.pot` file with the cake cli as well? |
# |
Jun 4th 2021, 19:25 |
aengblom |
Thanks for the tip! Unfortunately that didn't do it. I'm fairly new to this translating stuff. I've been studying the cakephp docs on i18n. If anyone has any video resources on the topic they would like to share, I would appreciate it very much. I do much better with videos for some reason. Thanks! |
# |
Jun 4th 2021, 19:17 |
kevin.pfeifer |
sometimes I need to do a `bin/cake cache clear_all` to have all newly tranlated strings be loaded correctly |
# |
Jun 4th 2021, 19:13 |
aengblom |
Has anyone ever encountered certain strings not translating even when __() is used and the string is translated in the po file? Nearly everything else in the app is translating except for a few strings. I'm not sure what is going on |
# |
Jun 4th 2021, 19:05 |
kevin.pfeifer |
sometimes its all just so flexible and can be re-used in so many places that it is hard to communicate a specific problem ^^ |
# |
Jun 4th 2021, 19:04 |
kevin.pfeifer |
but as you said Zuluru, Helpers are for Views (the V in MVC) :) However one decides to use that V :) |
# |
Jun 4th 2021, 19:03 |
greg138 |
And hence my question. ;) |
# |
Jun 4th 2021, 19:02 |
kevin.pfeifer |
sure. it depends what you define as backend and frontend :) |
# |
Jun 4th 2021, 19:02 |
greg138 |
And helpers can obviously be used in the views for admin pages. :) |
# |
Jun 4th 2021, 19:02 |
greg138 |
Some people consider "the admin pages" to be "backend", though... |
# |
Jun 4th 2021, 19:01 |
kevin.pfeifer |
shared backend logic can be inside components for controller or behaviours for models |