Issue with Locale api - translations.js 404
Hi Guys,
Appreciate if you can help me on my issue, I tried to do a fresh 2.8 install. however i noticed there's a 404 on the api for translations.js
upon checking the api list from my dashboard, i don't seem to have the api endpoint for it (api for getting the translations.js)
I've crossed compare it with the vanilla documentation here =>https://docs.vanillaforums.com/help/apiv2/swagger/
there's an extra api url for the .js file
May I know if there's anything i missed from the fresh install.
I actually don't need a translation as im using English for my forum. Is it possible or advisable to isable this api call (to retrieve the translations.js)
Some other infos that might be useful
a. /public_html/locales/ <empty>
b. inside the /conf folder, I only got these
c. I have this in my conf/config.php => $Configuration['Garden']['Locale'] = 'en';
Comments
My guess is that you haven't enabled pretty urls
@R_J pretty url works fine by the way and
gives us proper response
Maybe your server tries to serve static files directly.
But that translation.js is no static file: it is generated dynamically and as you see from the api result, there are translations like that included (just as a nexample):
Without that translation the string "BanReason.1" would appear in your forum instead of the informative sentence.
Sorry I just realized you wrote that:
upon checking the api list from my dashboard, i don't seem to have the api endpoint for it (api for getting the translations.js)
That's a problem. Please make sure that you have uploaded all files. Though this would be the easiest solution this is the most improbable...
And another senseless post from me. You can use the endpoint, therefore the files should be there, forget what I wrote: nothing helpful by now :-(
OMG! Seems like I do not read thoroughful and only babbling around today. In my installation there is only the above line for the locales api, too.
Sorry for all this confusion, I will only post again if I have taken time to think of what I have written, promised 🤐
hehe it's ok thanks for replying to my post @R_J right now as a quick hack. i copied the content of the translations.js from vanilla site. and created directories and static file just to satisfy the request. I'll also try to dig it later.
@SysCo This likely comes down to some server configuration issues.
If you have a configured block in your server matching on certain files such as
.json
you will need to ensure it falls back to the PHP-FPM process.Eg.
Notice the fallback in the first location's
try_files
directive.hi @charrondev arg yeah you are right! Since the api url ended up with .js it went to that block. Many thanks it's working now!
I am also facing the same issue.
@juliatom543 as @charrondev mentioned. it's a webserver config side issue, handling the url re-write.
Are you using NGINX ? or Apache?
The one above example is for Nginx conf file, if you are using Apache ensure that your mod_rewrite is working in order to handle the url with .js extension.
I am experiencing the same issue on apache, but I'm sure url rewrite is working as it should... any idea? Thanks in advance.
we cant get a clue if we cant see your apache settings. appreciate if you can post here.
You are right, sorry.
Vanilla Forum is installed in a subfolder (discuti/).
Attached you can find my htaccess, and my virtual host.
And here the virtual host
The problem is actually bigger than I thought:
I just tried migrating from 2.3.1 to 3.2, following all instructions on how to upgrade, and the frontend works as intended, while all api calls are not working.
Thanks in advance!
@Aolee any suggestions? Thanks!
Hi @masioramaweb sorry for the late reply. base on the error under the developer tool it looks not only translations.js but other JS as well. I haven't tried using a sub folder yet. but seems to be missing configuration for handling .js
Here is I being rather obvious. Are those files really existing in said location? If so, check their folder/file permission.
I join this thread because today I tried to get rid of those files altogether since the forum does not seem to even use them. I deleted the folder, but the call to the scripts seems hardcoded ... some webpack stuff
Hello @Aolee and @donshakespeare, thanks for your hints.
Indeed the files are not present in the directory dist, and it is completely empty (because I'm in Dev mode?).
Should I try to change environment (some variable in config.php maybe) and see what happens?
I have no idea how to exclude those files from webpack compilation if they are indeed not necessary... 😕
I believe the file that is culprit is
\vanilla-3.2\library\Vanilla\Web\Asset\WebpackAssetProvider.php
It adds files not using the familiar
addJSFile
code. It is hard for me to intercept.So in my emergency use case, in the function below I have returned an empty array. For now, this hack provides good riddance.
There is a huge caveat, entry points from Swagger API need those files ....