Base solution for your next web application
Open Closed

Cache translation files #4177


User avatar
0
walkerscott created

I think I am missing something in the documentation. But is it possible to cache the language translations (by source) for better performance? Note, we are using Zero interface for Host and a custom AngularJS based UI for Tenants/Users, but leveraging Abp functionality where possible.

Ideally we don't want to get all translation texts on each page load:

GET /api/services/app/Language/GetLanguageTexts

Thanks in advance

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

4 Answer(s)
  • User Avatar
    0
    alirizaadiyahsi created

    Hi @walkerscott,

    actually, translations loading with javascript when angular app start. So it is loading anly one time. Check following documentation: <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Localization#DocInJavascript">https://aspnetboilerplate.com/Pages/Doc ... Javascript</a>

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    walkerscott created

    Thanks for the reply. However, this is server side caching right?

    Are you doing any client side caching of translation files in AbpZero SPA interface, so the translation file persists across sessions?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    alirizaadiyahsi created

    Actually, I mean translations file is loading as static js file at client side. If you don't refresh the angular app page, they wont load again when you navigate beetweeb pages. So the translation file persists across angular UI open at browser. There is no client caching for this (because file is loading as static js file), but server caching.

    You can see server side caching values under Admin/Maintenance

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    walkerscott created

    Thanks, that is exactly where we got to.

    We are going to implement a new endpoint Language/GetLanguageTextsByLastModifiedDate and client side caching for performance in our AngularJS SPA.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)