Please upgrade here. These earlier versions are no longer being updated and have security issues.

Issue with Locale api - translations.js 404

AoleeAolee Hobbyist & Coder ✭✭
edited June 10 in Vanilla 2.0 - 2.8

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

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    My guess is that you haven't enabled pretty urls


  • AoleeAolee Hobbyist & Coder ✭✭
    edited June 10

    @R_J pretty url works fine by the way and

    /api/v2/locales/translations/en
    

    gives us proper response


  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    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):

    "BanReason.1":"Banned by a community manager."
    

    Without that translation the string "BanReason.1" would appear in your forum instead of the informative sentence.


  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    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...


  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    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 :-(


  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    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 🤐


  • AoleeAolee Hobbyist & Coder ✭✭

    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.

  • charrondevcharrondev Application Developer (PHP, JS) Montreal Vanilla Staff

    @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.

    location ~* \.(?:ico|css|js|gif|jpe?g|png|svg|woff)$ {
      expires 7d;
      add_header Pragma public;
      add_header Cache-Control "public";
      try_files $uri @vanilla;
    }
    
    # Default location handling
    location / {
      try_files $uri @vanilla;
    }
    	
    location @vanilla {
      fastcgi_param X_VANILLA 1;
      rewrite ^ /index.php$uri last;
    }
    

    Notice the fallback in the first location's try_files directive.

    Aolee
  • AoleeAolee Hobbyist & Coder ✭✭

    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.

  • AoleeAolee Hobbyist & Coder ✭✭
    edited June 17

    @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.

Sign In or Register to comment.