translations.js 854 B

1234567891011121314151617181920212223242526272829303132
  1. import App from '../base'
  2. App.controller(
  3. 'TranslationsPopupController',
  4. function ($scope, ipCookie, localStorage) {
  5. function getStoredDismissal() {
  6. const localStore = localStorage('hide-i18n-notification')
  7. if (localStore === null) {
  8. // Not stored in localStorage, check cookie
  9. const cookieStore = ipCookie('hidei18nNotification')
  10. // If stored in cookie, set on localStorage for forwards compat
  11. if (cookieStore) {
  12. localStorage('hide-i18n-notification', cookieStore)
  13. ipCookie.remove('hidei18nNotification')
  14. }
  15. return cookieStore
  16. }
  17. return localStore
  18. }
  19. $scope.hidei18nNotification = getStoredDismissal()
  20. $scope.dismiss = function () {
  21. localStorage('hide-i18n-notification', true)
  22. $scope.hidei18nNotification = true
  23. }
  24. }
  25. )