Skip to content

Commit

Permalink
Fixed language loading
Browse files Browse the repository at this point in the history
  • Loading branch information
randywoods1 committed Oct 3, 2023
1 parent c9ae1cb commit 51264ea
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 56 deletions.
7 changes: 2 additions & 5 deletions CSETWebNg/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1178,13 +1178,10 @@ import { UserLanguageComponent } from './dialogs/user-language/user-language.com
useFactory: (configSvc: ConfigService, authSvc: AuthenticationService, tSvc: TranslocoService) => {
return () => {
return configSvc.loadConfig().then(() => {
// Load and set the language based on config
return tSvc.load(configSvc.config.defaultLang).toPromise().then(() => {

// Set the default language based on config
tSvc.setActiveLang(configSvc.config.defaultLang);
return tSvc.load(configSvc.config.defaultLang).toPromise().then(() => {
return authSvc.checkLocal();
});
return authSvc.checkLocal();
});
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
-------------------------->
<ng-container *transloco="let t">
<div style="display: flex; justify-content: space-between;" class="my-5">
<button class="btn btn-primary" aria-label="Back" (click)="navSvc.navBack(page)" [class.display-hidden]="hide == 'back'" tabindex="0">{{ t('back') }}</button>
<button class="btn btn-primary" aria-label="Next" (click)="navSvc.navNext(page)" [class.display-hidden]="hide == 'next'" tabindex="0">{{ t('next') }}</button>
<button class="btn btn-primary" aria-label="Back" (click)="navSvc.navBack(page)" [class.display-hidden]="hide == 'back'" tabindex="0">{{ t('buttons.back') }}</button>
<button class="btn btn-primary" aria-label="Next" (click)="navSvc.navNext(page)" [class.display-hidden]="hide == 'next'" tabindex="0">{{ t('buttons.next') }}</button>
</div>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
<div class="d-flex flex-column align-items-end flex-00a w-100 mb-3">
<div class="d-flex align-items-start flex-11a">
<button class="btn btn-primary m-0 questions-header-collapse-button-radius" (click)="expandAll(false)"
[matTooltip]="t('collapse all')" [aria-label]="t('collapse all')"><i class="fas fa-compress-alt"></i></button>
<button class="btn btn-primary m-0 br-0" (click)="expandAll(true)" [matTooltip]="t('expand all')"
[aria-label]="t('expand all')">
[matTooltip]="t('buttons.collapse all')" [aria-label]="t('buttons.collapse all')"><i class="fas fa-compress-alt"></i></button>
<button class="btn btn-primary m-0 br-0" (click)="expandAll(true)" [matTooltip]="t('buttons.expand all')"
[aria-label]="t('buttons.expand all')">
<i class="fas fa-expand-alt"></i>
</button>
<button class="btn btn-primary m-0 questions-header-filter-button-radius" (click)="showFilterDialog()">
<i class="cset-icons-filter" [matTooltip]="t('filter')" [aria-label]="t('filter')"></i>
<i class="cset-icons-filter" [matTooltip]="t('buttons.filter')" [aria-label]="t('buttons.filter')"></i>
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-------------------------->
<div class="white-panel">
<div *transloco="let t" class="white-panel">
<div id="top"></div>
<div class="d-flex flex-column flex-wrap justify-content-between align-items-start flex-11a mb-4">

<div class="d-flex flex-row flex-wrap sticky-sal w-100 justify-content-end align-items-start flex-11a pb-3">
<div class="mr-3 answered-count" *ngIf="!!groupings"
matTooltip="Indicates the number of answered questions out of the total for this page">
matTooltip="{{t('tooltip.answered count')}}">
{{ completionSvc.answeredCount }}/{{ completionSvc.totalCount }}
</div>
<div>
<button class="btn btn-primary m-0 questions-header-collapse-button-radius" (click)="expandAll(false)"
matTooltip="Collapse All" aria-label="Collapse All">
matTooltip="{{t('buttons.collapse all')}}" aria-label="{{t('buttons.collapse all')}}">
<i class="fas fa-compress-alt"></i></button>
<button class="btn btn-primary m-0 br-0" (click)="expandAll(true)" matTooltip="Expand All"
aria-label="Expand All"><i class="fas fa-expand-alt"></i></button>
<button class="btn btn-primary m-0 br-0" (click)="expandAll(true)" matTooltip="{{t('buttons.expand all')}}"
aria-label="{{t('buttons.expand all')}}"><i class="fas fa-expand-alt"></i></button>
<button class="btn btn-primary m-0 questions-header-filter-button-radius" (click)="showFilterDialog()"
matTooltip="Filter">
<i class="cset-icons-filter" aria-label="Filter"></i>
matTooltip="{{t('buttons.filter')}}">
<i class="cset-icons-filter" aria-label="{{t('buttons.filter')}}"></i>
</button>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class MaturityQuestionsComponent implements OnInit {
this.filterSvc.maturityModelId = response.modelId;
this.filterSvc.maturityModelName = response.modelName;

this.pageTitle = this.questionsAlias + ' - ' + this.modelName;
this.pageTitle = this.tSvc.translate('titles.' + this.questionsAlias.toLowerCase().trim()) + ' - ' + this.modelName;
this.glossarySvc.glossaryEntries = response.glossary;

this.loaded = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<span *ngIf="displayIcon('REVIEWED')" class="btn-group btn-group-toggle">
<label class="btn btn-level form-check-label" [class.active]="myQuestion?.reviewed">
<input class="form-check-input" type="checkbox" data-toggle="toggle" (click)="storeReviewed($event)"
[checked]="myQuestion?.reviewed" />{{ 'reviewed' | transloco }}
[checked]="myQuestion?.reviewed" />{{ 'buttons.reviewed' | transloco }}
</label>
</span>

Expand Down
16 changes: 8 additions & 8 deletions CSETWebNg/src/app/assessment/questions/questions.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-------------------------->
<div class="white-panel">
<div *transloco="let t" class="white-panel">
<div id="top"></div>
<div class="d-flex flex-row flex-wrap sticky-sal justify-content-between align-items-start flex-11a pb-3">

Expand All @@ -42,32 +42,32 @@
</div>

<div class="d-flex flex-row">
<div class="mr-3 answered-count" *ngIf="!!categories" matTooltip="Indicates the number of answered questions out of the total for this page">
<div class="mr-3 answered-count" *ngIf="!!categories" matTooltip="{{t('tooltip.answered count')}}">
{{ completionSvc.answeredCount }}/{{ completionSvc.totalCount }}
</div>
<div class="d-flex flex-column align-items-start flex-00a">
<div class="d-flex align-items-start flex-11a">
<button class="btn btn-primary m-0 questions-header-collapse-button-radius" (click)="expandAll(false)"
matTooltip="Collapse All" aria-label="Collapse All"><i class="fas fa-compress-alt"></i></button>
<button class="btn btn-primary m-0 br-0" (click)="expandAll(true)" matTooltip="Expand All"
aria-label="Expand All">
[matTooltip]="t('buttons.collapse all')" [aria-label]="t('buttons.collapse all')"><i class="fas fa-compress-alt"></i></button>
<button class="btn btn-primary m-0 br-0" (click)="expandAll(true)" [matTooltip]="t('buttons.expand all')"
[aria-label]="t('buttons.expand all')">
<i class="fas fa-expand-alt"></i>
</button>
<button class="btn btn-primary m-0 questions-header-filter-button-radius" (click)="showFilterDialog()">
<i class="cset-icons-filter" matTooltip="Filter" aria-label="Filter"></i>
<i class="cset-icons-filter" [matTooltip]="t('buttons.filter')" [aria-label]="t('buttons.filter')"></i>
</button>
</div>

<div *ngIf="!browserIsIE() && !usesRAC()" class="mt-2">
<input type="checkbox" id="auto_load_supp" name="auto_load_supp" class="checkbox-custom"
[(ngModel)]="autoLoadSupplementalInfo" (change)="persistAutoLoadSetting()">
<label for="auto_load_supp" class="checkbox-custom-label" style="margin: 0 5px;">Auto-load Guidance</label>
<label for="auto_load_supp" class="checkbox-custom-label" style="margin: 0 5px;">{{t('auto load guidance')}}</label>
</div>
</div>
</div>
</div>

<h2>Standard Questions</h2>
<h2>{{t('titles.standard questions')}}</h2>
<div *ngIf="filterSvc.isFilterEngaged()" class="filters-engaged">Showing Only Filtered Questions</div>

<div *ngIf="!categories" class="w-100">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
-------------------------->
<div *transloco="let t; read: 'filterMenu'" class="d-flex flex-column justify-content-center flex-11a">
<div class="mat-dialog-header p-3 d-flex justify-content-start align-items-center flex-00a">
<span class="mr-3 fs-base-6 cset-icons-filter" [aria-label]="t('filter')"></span>
<span class="mr-3 fs-base-6 cset-icons-filter" aria-label="{{ 'buttons.filter' | transloco }}"></span>
<span>{{ t(question + ' filters') }}</span>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ export class UserLanguageComponent implements OnInit {
*
*/
save() {
this.tSvc.setActiveLang(this.langSelection);
this.authSvc.setUserLang(this.langSelection).subscribe(() => {
this.tSvc.load(this.langSelection).toPromise().then(() => {
this.tSvc.setActiveLang(this.langSelection);
this.authSvc.setUserLang(this.langSelection).subscribe(() => {
});
//
},
error => console.error('Error updating user langugage: ' + error.message));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</div>
<div class="input-bar-item" *ngIf="isSearch">
<div class="input-group">
<button class="btn btn-primary" (click)="cancelSearch()">{{t('button.back')}}</button>
<button class="btn btn-primary" (click)="cancelSearch()">{{t('buttons.back')}}</button>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-------------------------->
<div class="mx-4 mt-4">
<h4>Search Results</h4>
<div *transloco="let t" class="mx-4 mt-4">
<h4>{{t('titles.search results')}}</h4>
<div *ngIf="rows.length == 0">
No items were found matching the search request.
{{t('no search results')}}
</div>
<div style="height:235px; margin: 0 1.5rem" *ngFor="let row of rows">
<swiper class="gallery-slider" [config]="config" (slideChange)="onSlideChange()" #swiper>
Expand Down
19 changes: 11 additions & 8 deletions CSETWebNg/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@
"critical service description": "Critical Service Description",
"practices": "Practices",
"requires review": "Requires Review",
"next": "Next",
"back": "Back",
"expand all": "Expand All",
"collapse all": "Collapse All",
"filter": "Filter",
"reviewed": "Reviewed",
"domain": "Domain",
"maturity level": "Maturity Level",
"no search results": "No items were found matching the search request.",
"auto load guidance": "Auto-load Guidance",

"buttons": {
"ok": "OK",
"save": "Save",
Expand All @@ -51,12 +48,17 @@
"export": "Export",
"import": "Import",
"export all": "Export All",
"export all to excel": "Export All to Excel"
"export all to excel": "Export All to Excel",
"expand all": "Expand All",
"collapse all": "Collapse All",
"filter": "Filter",
"reviewed": "Reviewed"
},
"titles": {
"prepare": "Prepare",
"assessment": "Assessment",
"results": "Results",
"search results": "Search Results",
"assessment configuration": "Assessment Configuration",
"assessment information": "Assessment Information",
"service demographics": "Service Demographics",
Expand Down Expand Up @@ -175,7 +177,8 @@
"observations": "Observations",
"observations with content": "Observations with content",
"issues": "Issues",
"issues with content": "Issues with content"
"issues with content": "Issues with content",
"answered count": "Indicates the number of answered questions out of the total for this page"
},
"level": {
"low": "Low",
Expand Down
18 changes: 10 additions & 8 deletions CSETWebNg/src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@
"demographics": "Demografía",
"critical service name": "Nombre del servicio critíco",
"critical service description": "Descripción del servicio critíco",
"next": "Siguiente",
"back": "Previo",
"expand all": "Expandir todo",
"collapse all": "Desplegar todo",
"filter": "Filtrar",
"reviewed": "Revisado",
"domain": "Dominio",
"maturity level": "Nivel de madurez",
"no search results": "No se encontraron artículos que coincidan con la solicitud de búsqueda.",
"auto load guidance": "Carga automática de guía",

"contact": {
"contacts": "Contactos",
Expand Down Expand Up @@ -76,6 +72,7 @@
"prepare": "Preparar",
"assessment": "Evaluación",
"results": "Resultados",
"search results": "Resultados de la búsqueda",
"assessment configuration": "Configuración de evaluación",
"assessment information": "Información de evaluación",
"service demographics": "Demografía del servicio",
Expand Down Expand Up @@ -115,7 +112,11 @@
"export": "Exportar",
"import": "Importar",
"export all": "Exportar todo",
"export all to excel": "Exportar todo a Excel"
"export all to excel": "Exportar todo a Excel",
"expand all": "Expandir todo",
"collapse all": "Desplegar todo",
"filter": "Filtrar",
"reviewed": "Revisado"
},
"button-label": {
"Y": "",
Expand Down Expand Up @@ -168,7 +169,8 @@
"observations": "[ES] Observations",
"observations with content": "[ES] Observations with content",
"issues": "[ES] Issues",
"issues with content": "[ES] Issues with content"
"issues with content": "[ES] Issues with content",
"answered count": "Indica el número de preguntas respondidas del total de esta página"
},
"level": {
"low": "Pequeño",
Expand Down
24 changes: 20 additions & 4 deletions CSETWebNg/src/assets/i18n/uk.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"my assessments": "Мої оцінки",
"import": "Імпорт",
"export all": "Експортувати все",

"tools": "Інструменти",
"resource library": "Бібліотека ресурсів",
"help": "Довідка",
Expand All @@ -25,11 +24,14 @@
"assessment type": "Тип оцінки",
"demographics": "Демографія",
"requires review": "Потребує перегляду",
"no search results": "Не знайдено елементів, що відповідають пошуковому запиту.",
"auto load guidance": "Автоматичне завантаження вказівок",

"titles": {
"prepare": "Приготуйте",
"assessment": "Оцінка",
"results": "Результати",
"search results": "Результати пошуку",
"assessment configuration": "Конфігурація оцінювання",
"assessment information": "Інформація про оцінку",
"service demographics": "Service Demographics",
Expand All @@ -56,8 +58,21 @@
"cancel": "Скасувати",
"change": "Змінити",
"remove": "Видалити",
"email": "Email",
"next": "Далі",
"back": "Назад"
"close": "Close",
"back": "Назад",
"login": "Логін",
"logout": "Вийти",
"analytics": "Аналітика",
"import": "Імпорт",
"export": "Експорт",
"export all": "Експортувати все",
"export all to excel": "???",
"expand all": "Розгорнути все",
"collapse all": "Закрити все",
"filter": "фільтр",
"reviewed": "Переглянуто"
},


Expand Down Expand Up @@ -108,7 +123,8 @@
"NI-C2M2": "[UK] Not Implemented - Absent; the practice is not performed by the organization",

"mfr-flag": "Цей контроль потребує додаткового перегляду",
"requires-review": "Один або кілька елементів керування в цій категорії потребують додаткової перевірки."
"requires-review": "Один або кілька елементів керування в цій категорії потребують додаткової перевірки.",
"answered count": "Вказує кількість запитань із відповідями на цій сторінці"
},
"answer-label": {
"FI-C2M2": "[UK] Fully Implemented (FI)",
Expand Down
2 changes: 1 addition & 1 deletion CSETWebNg/src/assets/navigation/workflow-omni.xml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
<node displaytext="Security Practice Checklist" id="cpg-practices-page" path="assessment/{:id}/results/cpg-practices-page" condition="MATURITY:11" />

<!-- Results - SD02-Series -->
<node displaytext="SD02-Series Pipeline Answer Summary" id="sd-answer-summary" path="assessment/{:id}/results/sd-answer-summary" condition="MATURITY:14" />
<node displaytext="SD02 Series Pipeline Answer Summary" id="sd-answer-summary" path="assessment/{:id}/results/sd-answer-summary" condition="MATURITY:14" />

<!-- Results - Diagram -->
<node displaytext="Components Results" condition="OPTION:DIAGRAM">
Expand Down

0 comments on commit 51264ea

Please sign in to comment.