mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-16 10:28:49 -07:00
Merge branch 'pr-1636'
* pr-1636: Store and use _localStorage object fix using detect localStorage
This commit is contained in:
commit
9359daa0d9
@ -2,8 +2,23 @@ angular.module('syncthing.core')
|
||||
.provider('LocaleService', function () {
|
||||
'use strict';
|
||||
|
||||
function detectLocalStorage() {
|
||||
// Feature detect localStorage; https://mathiasbynens.be/notes/localstorage-pattern
|
||||
try {
|
||||
var uid = new Date();
|
||||
var storage = window.localStorage;
|
||||
storage.setItem(uid, uid);
|
||||
var success = storage.getItem(uid) == uid;
|
||||
storage.removeItem(uid);
|
||||
return storage;
|
||||
} catch (exception) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
var _defaultLocale,
|
||||
_availableLocales;
|
||||
_availableLocales,
|
||||
_localStorage = detectLocalStorage();
|
||||
|
||||
var _SYNLANG = "SYN_LANG"; // const key for localStorage
|
||||
|
||||
@ -18,6 +33,7 @@ angular.module('syncthing.core')
|
||||
_availableLocales = locales;
|
||||
};
|
||||
|
||||
|
||||
this.$get = ['$http', '$translate', '$location', function ($http, $translate, $location) {
|
||||
|
||||
/**
|
||||
@ -32,22 +48,10 @@ angular.module('syncthing.core')
|
||||
}
|
||||
|
||||
function autoConfigLocale() {
|
||||
// Feature detect localStorage; https://mathiasbynens.be/notes/localstorage-pattern
|
||||
var storage;
|
||||
var fail;
|
||||
var uid;
|
||||
try {
|
||||
uid = new Date;
|
||||
(storage = window.localStorage).setItem(uid, uid);
|
||||
fail = storage.getItem(uid) != uid;
|
||||
storage.removeItem(uid);
|
||||
fail && (storage = false);
|
||||
} catch (exception) {}
|
||||
|
||||
var params = $location.search();
|
||||
var savedLang;
|
||||
if (storage) {
|
||||
savedLang = storage[_SYNLANG];
|
||||
if (_localStorage) {
|
||||
savedLang = _localStorage[_SYNLANG];
|
||||
}
|
||||
|
||||
if(params.lang) {
|
||||
@ -99,8 +103,8 @@ angular.module('syncthing.core')
|
||||
function useLocale(language, save2Storage) {
|
||||
if (language) {
|
||||
$translate.use(language).then(function () {
|
||||
if (save2Storage && typeof(localStorage) != 'undefined')
|
||||
localStorage[_SYNLANG] = language;
|
||||
if (save2Storage && _localStorage)
|
||||
_localStorage[_SYNLANG] = language;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
AssetsBuildDate = "Thu, 16 Apr 2015 14:26:49 GMT"
|
||||
AssetsBuildDate = "Thu, 16 Apr 2015 14:40:42 GMT"
|
||||
)
|
||||
|
||||
func Assets() map[string][]byte {
|
||||
@ -109,7 +109,7 @@ func Assets() map[string][]byte {
|
||||
|
||||
assets["scripts/syncthing/core/module.js"], _ = base64.StdEncoding.DecodeString("H4sIAAAJbogA/0rMSy/NSSzSy81PKc1J1VAvrsxLLsnIzEvXS84vSlXXUYiO1bTmAgAAAP//AQAA//+OUhsnJgAAAA==")
|
||||
|
||||
assets["scripts/syncthing/core/services/localeService.js"], _ = base64.StdEncoding.DecodeString("H4sIAAAJbogA/5Q5e3Mat/b/51Po5+nUuLV5LmDiX+50H5Cbqet0gu+0N0knI0CAyrJLJS026eS733OOtOwCayfVH7I4OjovnZfWPFlkMVf1dTrLYlE717tkapYyWdSnqRLnFy8YjPpGpVs5E6p2fptOeSzGQm3lVJxfsnkG+DJNWO2C/U3IOM4zLZg2Sk7N+c2LPXjLFfs0E3OexcYSutzv4fjEt1zGfBILu6uPz47/e3fr371mr9gZLD/h+uyGNRpsmibasJXYsXmqWIynxyZVfCEKCoCWcCO3Av6shWbp3CLC8k9grKdKbgwTeso3YnbI9/Zt6N8Ox5/u/F+GY+D+Nzvj87OX7MyfK7niPNFnlwBaI+hj1mr7TZxbAc7tCOdBQBjKYjR77T7OnodzZ0Bzi+DXBPdpPaAz2p0ZXHdxDhBj4A9xDpu0HhE8pHlozxiSTptMSZ5kCJsIR8drISev06U5oBnpeJ6dOzRbHL+0OyIqi0Mqnl+i0jmhVaZyT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+x3j6D5AQ+NCvq6PGYQAlafS04//kOFiSIlgm3zTGkW4pfEq30r8njUZRU9wSrluxLVZ39pva3xMCF2CV1Iu3x091Knvmyp7uZ4vlUBw4Fdh2COalV/4e5gktZEuzwzG4j0nntoBXFPvI8Ax+dS0hT7t/bT43yyaK7ckk/q2y9yXr/1L4ufk6VO35uvDyBnJbF/R29LJanWNBbh5lS0DzkyLmZ0cr7R9PhxVywL5WUjl/p1cRO3+XV1NxuJPUm5rs7/Ff9EwQP/yt/bOL9Kq/NeC//AwAA//8BAAD//3iduujvIAAA")
|
||||
assets["scripts/syncthing/core/services/localeService.js"], _ = base64.StdEncoding.DecodeString("H4sIAAAJbogA/5QZa3PbNvJ7fgXG06nl1pb1oCQrudyUDymXqet0It+0l6TjgShIQkWRKgDKVjr+77e7IEVSou2UH2Bosdhd7BswjxdpxFVznczSSDRO9S4OzVLGi2aYKHF69orB19yoZCtnQjVOr5OQR2Ii1FaG4vSczVPAl0nMGmfsb0LG7zTVgmmjZGhO37zag/fIM2FEaIjWxCSKL0RlO36Xl2wsuEmVyLBZVEJ/w5bGbPTry8s1B3G5nu5iEevmVFzGiRH6kpC1Rb7YcGOEiiv0jdodcMRvyxVL5Yy9ZbG4ZwE3INibWqyMNmDey3iW3Dcr4h1tydCbWpj3RqwbwOQcOT1FPQ1DoTVQzzcuio1n7O1b3Ps0FyXWyVbs8Y8RlQDNxjl+df2RhdyES9YQD6HYoL0ObVOikMYzMZexOBDm8VUxe1U+2B2g8zSythfnlU13fMtlxKeRsKv6YLmsYdBMnRO9OeA2+d/NtXvzDrBPYHqH85M36FthEmvDVmLH5omquFZBAdBibuRWwJ+10CyZW0SY/gmi6lDJjWFCh3wjZlW+1x9893o0ubtxfxlNgPvf7ITPT16zE3eu5IrzWJ+cA2iNoC9pu+O2cGx7OHYCHIceYSiL0ep3Bjg6Do7dIY1tgl8R3KX5kPbobM/wqoejhxhDd4Sj36L5mOA+jSO7x5B0GowqeZwibCoyOk4bOTndHo0ejUj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7rKV0eFmrJ3Z8Paunlq0GUm8ivrvB/9g+QbD6z9lDFe9neRlGu/wfAAD//wEAAP//NZVcxichAAA=")
|
||||
|
||||
assets["vendor/angular/angular-translate-loader.min.js"], _ = base64.StdEncoding.DecodeString("H4sIAAAJbogA/0SPsW4iMRCG+3sKM0I6W7L8AKCrTtw16ZIOURh7nDXx2pvxLAQtvHucJZBuPP413/fb/DomS6YvfkwoYbDV2TQQuo4Nk801WUZQJljHhc4Slo/tM1uO7l9MWJ+K9Uigt7B8Bw3LjnkAHcbsOJYsrd6riZBHyuKxdGqKQS7c5bJwphFD/JjHOoY2Ku6onETGk9gQFZLwt4zJ598sUoOJOsNF+KJrkYu4XRCFxO2AqAO6GCL6Baj10ZLwf6zxGJCkWn/L7OU0Ulpt7wLamTc867vEzhxKzBJA6R65K34F/zcvoAdLtq8rgKtqSeewVvlTVk3eENaSjtgeLYJzgUfg9n9Ax3LGtYj2TaD0seL1ulPrX58AAAD//wEAAP//1rAncZcBAAA=")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user