DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

SPA modules & Localization

Sort:
You are not authorized to post a reply.





New Around Here





    If you do any kind of SPA apps for DNN,one difficulty is to localize the Javascript app.

    Usually the language packages are created in DNN in the form of resx files. If a SPA module is built, each term must be queried individually via a token, e.g. with [Resx:Save.Text] .

    It would be easier to query a translated package as a Json Dictionary. I have setup a github repository with an early prototype. Currently this service would be able to query any localization resource within DNN. Disadvantage is still the dot in the keys, i.e. access in JS via resx["Save.Text"].
    If we would replace the "." with a "_" in the keys of the dictionary, we would even have simple javascript objects, e.g. resx.Save_Text 

    What do you think? Is this of common interest? Do you have any concern? Every kind of feedback appreciated. 

     

    Best regards,
    Stefan Cullmann

    F# and DNN? A perfect match





    Advanced Member





      Yes, it is of total interest. I wanted to look into this, some areas of the persona bar have an utility for it but it fetches on every single request, I saw some code in there that looked a bit better than what I see hapening in the browser so I don't know if work was started towards a better solution but never used or what...

      I would love to have an api endpoint to fetch a whole localizatio file and cache it in the browser local storage api. Then another endpoint to just report the last modified DateTime of any resource file, this value would get updated whenever someone updates any localization file using the UI as well as with any module install and with the clear cache feature.

      SPA modules can then fetch their localization file only if it is not already in local storage, if not consume that local one and instead just look at the other api to see if you are due to pull changes or the local one is fine.

      I have done 'some' work towards that for other purposes and would like to apply those same principles to localization files as a reusable thing for module developers.
      You are not authorized to post a reply.

      These Forums are dedicated to the discussion of DNN Platform.

      For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

      1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
      2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
      3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
      4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
      5. No Flaming or Trolling.
      6. No Profanity, Racism, or Prejudice.
      7. Site Moderators have the final word on approving / removing a thread or post or comment.
      8. English language posting only, please.

      Would you like to help us?

      Awesome! Simply post in the forums using the link below and we'll get you started.

      Get Involved