locale.html 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <html>
  2. <head>
  3. <title>Locale</title>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
  6. <link rel="stylesheet" href="../../script/semantic/semantic.css">
  7. <script type="application/javascript" src="../../script/jquery.min.js"></script>
  8. <script type="application/javascript" src="../../script/clipboard.min.js"></script>
  9. <script type="application/javascript" src="../../script/semantic/semantic.js"></script>
  10. </head>
  11. <body>
  12. <div class="ui container">
  13. <div class="ui basic segment">
  14. <div class="ui header">
  15. <i class="translate icon"></i>
  16. <div class="content">
  17. Language setting
  18. <div class="sub header">You can change the display language here.<br> The language setting will only affect the current computer.</div>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="ui divider"></div>
  23. <div class="ui green inverted segment" style="display:none;" id="updateSet">
  24. <h5 class="ui header">
  25. <i class="checkmark icon"></i>
  26. <div class="content">
  27. Setting Updated. Please sign out to apply these changes.
  28. </div>
  29. </h5>
  30. </div>
  31. <div class="ui form">
  32. <div class="field">
  33. <label>Display language</label>
  34. <div class="ui selection dropdown">
  35. <input id="language" type="hidden" name="language">
  36. <i class="dropdown icon"></i>
  37. <div class="default text">Language</div>
  38. <div class="menu" id="langlist">
  39. <div class="item" data-value="default">Browser Default</div>
  40. </div>
  41. </div>
  42. </div>
  43. <button id="ntb" onclick="update();" class="ui green button" type="submit">Update</button>
  44. </div>
  45. </div>
  46. <script>
  47. $("#language").val(localStorage.getItem('global_language'));
  48. $('.selection.dropdown').dropdown();
  49. function update() {
  50. localStorage.setItem('global_language', $("#language").val());
  51. $("#updateSet").stop().finish().slideDown("fast").delay(3000).slideUp('fast');
  52. }
  53. //Updates 13 Nov: Remove hardcoded lang option and get lang option from file manager's localization file
  54. $.getJSON("../locale/file_explorer.json", function(data){
  55. for (let [key, value] of Object.entries(data.keys)) {
  56. let langName = value.name;
  57. if (langName == undefined || langName == null){
  58. langName = key;
  59. }
  60. console.log(langName, key);
  61. $("#langlist").append(`<div class="item" data-value="${key}">${langName}</div>`);
  62. }
  63. });
  64. </script>
  65. </body>
  66. </html>