Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,14 @@ replay_pid*
/medplat-ui/nbproject/private/
/medplat-ui/bower_components/
/medplat-ui/node_modules/

# Local development artifacts
/node_modules/
/package-lock.json
/package.json
/usr/
/medplat-android/.gradle/
/medplat-web/bower_components/

# Build output / generated files
/medplat-ui/dist/
14 changes: 13 additions & 1 deletion medplat-ui/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,24 @@
'ui.mask',
'daterangepicker',
'textAngular',
'config'
'config',
"pascalprecht.translate"
]);
as.config(function (AuthenticateServiceProvider, MaskProvider) {
MaskProvider.setTemplate('<i class ="fa fa-cog fa-spin fa-2x"></i>');
AuthenticateServiceProvider.setClientDetails('imtecho-ui', 'imtecho-ui-secret');
});
as.config(['$translateProvider', function ($translateProvider) {

$translateProvider.useStaticFilesLoader({
prefix: 'app/locales/',
suffix: '.json'
});

$translateProvider.preferredLanguage('en');
$translateProvider.fallbackLanguage('en');
$translateProvider.useSanitizeValueStrategy(null);
}]);
as.run(function ($rootScope, AuthenticateService, $state, toaster, Mask, Navigation, $http, APP_CONFIG, UUIDgenerator, $stateParams) {
$rootScope.isLoggedIn = false;
$rootScope.isLocked = false;
Expand Down
11 changes: 11 additions & 0 deletions medplat-ui/app/locales/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"LOGIN": {
"TITLE": "Login",
"USERNAME": "Username",
"PASSWORD": "Password",
"SUBMIT": "Submit",
"LOST_PASSWORD": "Lost your password?",
"DESCRIPTION": "A low code comprehensive Primary Healthcare management Platform",
"PLEASE_NOTE": "Please Note:"
}
}
11 changes: 11 additions & 0 deletions medplat-ui/app/locales/hi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"LOGIN": {
"TITLE": "लॉगिन",
"USERNAME": "उपयोगकर्ता नाम",
"PASSWORD": "पासवर्ड",
"SUBMIT": "जमा करें",
"LOST_PASSWORD": "पासवर्ड भूल गए?",
"DESCRIPTION": "सार्वजनिक स्वास्थ्य के लिए प्राथमिक स्वास्थ्य देखभाल प्रबंधन मंच",
"PLEASE_NOTE": "कृपया ध्यान दें:"
}
}
22 changes: 20 additions & 2 deletions medplat-ui/app/login/controllers/login.controller.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
(function (angular) {
function LoginController(AuthenticateService, $rootScope, $state, States, Mask, GeneralUtil) {
function LoginController(AuthenticateService, $rootScope, $state, States, Mask, GeneralUtil, $translate) {
var login = this;
login.user = {};
login.as = { user: {} };
login.showSystemNotice = false;
login.hideAppLink = false;
login.env = GeneralUtil.getEnv();
login.currentLang = $translate.use() || 'en';
login.languages = [
{ code: 'en', name: 'English' },
{ code: 'hi', name: 'हिन्दी' }
];

login.changeLanguage = function(langCode) {
$translate.use(langCode);
login.currentLang = langCode;
localStorage.setItem('preferredLanguage', langCode);
};
login.init = () => {
var savedLang = localStorage.getItem('preferredLanguage');
if(savedLang) {
$translate.use(savedLang);
login.currentLang = savedLang;
}
[login.imagesPath, login.logoImages] = GeneralUtil.getLogoImages();
Mask.show();
AuthenticateService.getSystemNotice().then((response) => {
Expand Down Expand Up @@ -107,5 +122,8 @@

login.init();
}

LoginController.$inject = ['AuthenticateService', '$rootScope', '$state', 'States', 'Mask', 'GeneralUtil', '$translate'];

angular.module('imtecho.controllers').controller('LoginController', LoginController);
})(window.angular);
})(window.angular);
18 changes: 18 additions & 0 deletions medplat-web/src/main/i18n.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import en from './locales/en.json';
import hi from './locales/hi.json';

i18n
.use(initReactI18next)
.init({
resources: {
en: { translation: en },
hi: { translation: hi }
},
lng: 'en', // default language
fallbackLng: 'en',
interpolation: { escapeValue: false }
});

export default i18n;