Search code examples
javascriptangularjslocalizationinternationalizationangularjs-filter

How to localize / internationalize baSidebar of Blur Admin


i'am trying to localize the baSidebar Navigation of Akveos BlurAdmin.

In the ba-sidebar.html i'am using the translate-filter like {{ ::item.title | translate }} and the state ist set like:

function routeConfig($stateProvider, dashboardProvider) {
        $stateProvider
            .state('stateName', {
                url: '/stateName',
                templateUrl: 'app/pages/[...],
                controller: 'stateNameCtrl',
                title: 'TITLES.STATENAME',
                sidebarMeta: {
                    order: 200,
                },
            }) [...]

Angular gets the translation of TITLES.STATENAME from a .json-file. The title of the contentTop is perfectly changing by changing the active language. (i'm using $state.reload(); by ng-click). But the sidebar wont reload. The title still be in the same language which was active while loading the page. If i log off and log in again, the new language is active and shown correctly.

Is there a way to reload the ba-sidebar.html within an ng-click-event like i did with $state.reload()? (i dont want to reload the entire page, because then the site reloads all defaults including the default language)


Solution

  • I solved the problem by saving the language in cookies and reloading the entire page. on load it gets the language from the cookies. if this languagekey isn't set, it loads the default language.

    For people who get stuck in the same issue: here is a documentation of using cookies in javascript: http://www.w3schools.com/js/js_cookies.asp