• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Plugins texts not translated on cold refresh.

Scheduled Pinned Locked Moved Bug Reports
10 Posts 5 Posters 2.7k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jareyJ Offline
    jareyJ Offline
    jarey Translator
    wrote on last edited by
    #1

    Hello,

    On nodebb-plugin-ignore-users i have a custom tpl that shows some data.

    This .tpl has i18n messages that show fine when navigating via ajaxify. But if i refresh the page vía F5, the strings are not translated correctly and the strings showed are in the specified fallback locale. The .tpl just make use of standard i18n support: [[file:i18n_message]] and as said before the mechanism works well in standard navigation via ajaxify.

    Could be a generalized bug? I have not noticed it since I changed from English language, to another one; so the bug could have been undetected till now since most of users use nodebb in english (personal thought).

    Thanks in advance.

    PitaJP pichaliteP 2 Replies Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    replied to jarey on last edited by
    #2

    @jarey have you set a default language in the plugin?

    1 Reply Last reply
    0
  • pichaliteP Offline
    pichaliteP Offline
    pichalite Plugin & Theme Dev
    replied to jarey on last edited by
    #3

    @jarey do you use nginx to serve static assets?

    jareyJ 1 Reply Last reply
    0
  • jareyJ Offline
    jareyJ Offline
    jarey Translator
    replied to pichalite on last edited by jarey
    #4

    @PitaJ i do have en_GB as default language set on the config of the plugin.
    https://github.com/jarey/nodebb-plugin-ignore-users/blob/master/plugin.json#L56

    @pichalite I do not use ngix or apache, it reproduces on my dev environment, running only ./nodebb dev.

    1 Reply Last reply
    0
  • psychobunnyP Offline
    psychobunnyP Offline
    psychobunny
    wrote on last edited by
    #5

    As an aside, you are maintaining a different fork from @exodo's version? I had made a couple PRs to his repo earlier.

    I didn't notice a problem with language strings though

    jareyJ 1 Reply Last reply
    0
  • jareyJ Offline
    jareyJ Offline
    jarey Translator
    replied to psychobunny on last edited by jarey
    #6

    @psychobunny no, indeed I maintain exodo's fork. My personal fork is sync with exodo's and of course includes your merged PR's. I only posted the link to mine since there is where i do development itself.

    1 Reply Last reply
    0
  • jareyJ Offline
    jareyJ Offline
    jarey Translator
    wrote on last edited by jarey
    #7

    Just re-tested this today and it stills reproduces on every environment.

    Some detail here (don't really know if it will help, since i'm not very familiar with the renderin engine on ajaxify and on cold refresh, but here it goes):

    • Requests made on ajaxify navigation:

    0_1471972636055_upload-a977500d-1277-4037-b8e0-985281a7e587

    The highlighted request response is the correct data, based on the language preference for the user, that in my case is "es" from Spanish:

    {"ignore":"Ignorar","unignore":"Dejar de ignorar","ignored":"Ignorados","ignore_user":"Ignorar usuario","unignore_user":"Dejar de ignorar","ignored_list":"Lista de ignorados","chat_ignored_list":"Lista de chats ignorados","ignored_no_one":"No tienes a nadie en tu lista de ignorados :)","ignored_post":"Este mensaje está oculto porque su autor está en tu lista de ignorados.","ignoring_confirmation":"Ahora estás ignorando a: %1.","unignoring_confirmation":"Ya no estás ignorando a %1.","chat.ignore":"Ignorar chats","chat.unignore":"Dejar de ignorar chats","chat.ignored":"Chats ignorados","chat.ignore_user":"Ignorar chats","chat.unignore_user":"Dejar de ignorar chats","chat.ignored_list":"Lista de chats ignorados","chat.ignored_no_one":"Tu lista de chats ignorados está vacía :)","chat.ignoring_confirmation":"Desde ahora estás ignorando los chats de %1.","chat.unignoring_confirmation":"Has dejado de ignorar los chats de %1."}

    That match the result already told (messages in spanish, expected result):

    0_1471972805095_upload-3c335018-f0e4-4acd-abb9-f315cf711d3d

    • Here the requests made on cold refresh under the same route (can only see 2 related to the plugin):

    0_1471973157063_upload-6605dea9-3087-4d56-9892-26a7362d18b0

    0_1471973250247_upload-c870856b-bd1c-4fb7-8187-84e6ab3e7fd6

    0_1471973575946_upload-b997e664-d9b0-435e-a359-8927f2df67f9

    • Result:
      0_1471973358647_upload-a371669e-18cb-4eb0-ab55-332afe38b7f4

    So, any tought on what can be causing this?

    Any insight/explanation on how the render engine works, in order to debug this issue is really appreciated.

    Thanks in advance.

    1 Reply Last reply
    1
  • jareyJ Offline
    jareyJ Offline
    jarey Translator
    wrote on last edited by
    #8

    up! could @administrators get a little peek on it?

    1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by baris
    #9

    Not sure why it isn't working but here is how it works.

    On cold load we load the current user's language setting and store it in res.locals.config https://github.com/NodeBB/NodeBB/blob/master/src/middleware/header.js#L40

    Then when you call res.render() we render the page and translate it using that setting. https://github.com/NodeBB/NodeBB/blob/master/src/middleware/render.js#L83-L85

    If for some reason res.locals.config is not set then it defaults to en_GB. You can check it out by putting some console logs there.

    When you ajaxify all the parsing and translation happens client side. https://github.com/NodeBB/NodeBB/blob/master/public/src/ajaxify.js#L175 which uses the users language value from config.

    jareyJ 1 Reply Last reply
    1
  • jareyJ Offline
    jareyJ Offline
    jarey Translator
    replied to <baris> on last edited by
    #10

    @baris thank you very much! I will try to find out what is not working here! I'll let you know if there's a possible bug involved.

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development