Is there a proper way to deploy a application translated with angular-translate, which fails to load i18n files the first time that it runs?

I have to deploy live an application with translations. The application is developed in front-end with angularjs and the back-end with C#. Now I have a problem. The i18n files contains the .json files that will translate the content when I switch from the toolbar. When I make tests in localhost everything is right, and application runs very well. But I won’t make the translations to keep it locally. I put it on inetpub folder the dist files that gulp build command generates me, and when I run the application happens the issue. In my application the first page that shows to the user is login page. In this application I have worked with localStorage to switch languages. And the first step is this:

$translateProvider.useLoader("$translatePartialLoader", {
  urlTemplate: "{part}/i18n/{lang}.json"
});

//sets Albanian as primary language when cache and localStorage has been cleared
if (JSON.parse(localStorage.getItem("flexBOARDLanguage")) === null) {
 var DefaultLanguage = {
    title: "Shqip",
    translation: "TOOLBAR.SHQIP",
   code: "al",
   flag: "al"
  };

  localStorage.setItem(
    "flexBOARDLanguage",
    JSON.stringify(DefaultLanguage)
 );
  var lang = JSON.parse(localStorage.getItem("flexBOARDLanguage"));
  console.log(lang.code);
  $translateProvider.preferredLanguage(lang.code);
} else {
  var lang = JSON.parse(localStorage.getItem("flexBOARDLanguage"));
$translateProvider.preferredLanguage(lang.code);
}
$translateProvider.preferredLanguage(lang.code);
$translateProvider.useSanitizeValueStrategy("sanitize");

As you can see I check for language in localStorageand if there is not language I put the default to use it after.
Now when I run the application in the login page shows me the keys from i18n files. But when I switch to another language the application translates and the files are loaded. This issue happens only in login page because in all the application works very well, after I login.

How can I fix this?

UPDATE!!!!!

I fix it by adding this command:

 $translateProvider.fallbackLanguage(lang.code);

So if anyone has this issue this might help.

Source: AngularJS