BoltTranslate / labels

Bolt Labels extension - Translatable labels for Bolt
https://bolt.cm/
18 stars 12 forks source link

Installation out of the box fails #9

Closed phpetra closed 7 years ago

phpetra commented 8 years ago

@bobdenotter I did some debugging for the labels extension and have found 2 things:

However trying to use them in the frontend does not work. I get english no matter what I try. {{ lang }} remains empty.

I have an idea about why it doesn't work from looking at your code earlier so I'll look into that and will create a PR at least for the snippet.

The setup I had earlier today was an installation through creating a project with composer composer create-project bolt/composer-install and maybe because the paths and folders in that installation are are different (or something else?) I could not get the assets loaded in the backend. Adding the htmlsnippets line had no effect. How to solve this I have no clue. Have you any idea?

phpetra commented 8 years ago

@bobdenotter I've just had another look and the reason it fails in that installation is because it looks for the assets in the "wrong" place:

"NetworkError: 404 Not Found - http://dev.local/extensions/vendor/bolt/labels/assets/handsontable.full.min.css" handson...min.css

"NetworkError: 404 Not Found - http://dev.local/extensions/vendor/bolt/labels/assets/handsontable.full.min.js" handson....min.js


The extension with all it's files get installed in the /extensions dir while the doc_root in this setup is the /public dir. There is also a /public/extensions folder but that is empty. Manually creating the desired folders and moving the files there fixes things.

The locations of files and folders when using the composer create project method is different. I think it's better (moving files out of the doc_root) but it is causing this problem. Or is there a setting somewhere that I can manipulate?

GwendolenLynch commented 8 years ago

For Composer based installs to work, in the "extra" section of composer.json you need to add:

    "extra" : {
        "bolt-assets" : "assets/",
bobdenotter commented 8 years ago

@phpetra

However trying to use them in the frontend does not work. I get english no matter what I try. {{ lang }} remains empty.

Have you tried {{ setlanguage('nl') }} ?

phpetra commented 8 years ago

@GawainLynch That doesn't seem to change anything. The backend is still looking for the files in: /extensions/vendor/bolt/labels/assets (which is path /public/extensions/...etc)

I fixed it now by manually coping the files.

@bobdenotter Yes... you're a bit late to the party: you know I fixed that with the PR in the extension? :-P

GwendolenLynch commented 8 years ago

@phpetra that tells the Composer installer to take an action on install, via composer… see the ExtensionInstaller class in 2.2 (changed in master/2.3).

phpetra commented 8 years ago

@GawainLynch Aaha! yes, I see. So re-installing the package should do it.

phpetra commented 8 years ago

@GawainLynch In that case I think I need to create a new PR cause that extra dir probably needs to be in the composer.json of this labels package, right? See (https://github.com/bolt/labels/blob/master/composer.json#L23)

GwendolenLynch commented 8 years ago

Yes mate… My apologies, I can absolutely see how easily my comment would, itself, not be easy to interpret for someone that did not have the intimate knowledge of the code base that I do… A fail on my part :grin:

GwendolenLynch commented 8 years ago

In that case I think I need to create a new PR

Yes, I am at the top of the naughty list with my extensions for not having this in all of them… Please send one in :+1:

phpetra commented 8 years ago

@GawainLynch No problem (or apologies needed). I am discovering things as we go along ;-)

GwendolenLynch commented 7 years ago

Clean up mode… Call out if the two rewrites since this was opened haven't caught everything.

phpetra commented 7 years ago

@GawainLynch Since this was an issue of over a year old, I have no idea anymore ;-)