Skip to content

Commit

Permalink
Fix a few errors in translations setup and user management (#3439)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaskikutis authored Apr 20, 2020
1 parent a2fe248 commit cc1cc53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scripts/apps/users/directives/UserEditDirective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export function UserEditDirective(api, notify, usersService, userList, session,
};

function validateField(response, field) {
if (scope.userForm[field]) {
if (scope.userForm?.[field]) {
if (scope.error[field]) {
scope.error.message = null;
}
Expand Down
16 changes: 11 additions & 5 deletions scripts/core/services/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ export default angular.module('superdesk.core.translate', [
function(gettextCatalog, $location, $rootScope, SESSION_EVENTS, tmhDynamicLocale) {
$rootScope.$on(SESSION_EVENTS.IDENTITY_LOADED, (event) => {
loadTranslations()
.then(({translations, language}) => {
gettextCatalog.setCurrentLanguage(language);
gettextCatalog.setStrings(language, translations);
moment.locale(language); // set locale for date/time management
tmhDynamicLocale.set(language.replace('_', '-').toLowerCase()); // set locale for angular-i18n
.then((res) => {
if (res != null) { // null when default language is selected
const {translations, language} = res;

gettextCatalog.setCurrentLanguage(language);
gettextCatalog.setStrings(language, translations);
moment.locale(language); // set locale for date/time management

// set locale for angular-i18n
tmhDynamicLocale.set(language.replace('_', '-').toLowerCase());
}
});
});

Expand Down

0 comments on commit cc1cc53

Please sign in to comment.