Skip to content

Commit

Permalink
VIH-10627 add missing translations (#2141)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaed-parkar authored May 14, 2024
1 parent 84d55ca commit 4b190d7
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ConferenceForHostResponse, ConferenceStatus } from 'src/app/services/cl
import { Logger } from 'src/app/services/logging/logger-base';
import { JudgeHearingSummary } from 'src/app/shared/models/JudgeHearingSummary';
import { ParticipantSummary } from 'src/app/shared/models/participant-summary';
import { convertStringToTranslationId } from 'src/app/shared/translation-id-converter';

@Component({
selector: 'app-host-hearing-table',
Expand All @@ -29,7 +30,7 @@ export class HostHearingTableComponent implements OnInit {
}

stringToTranslateId(str: string) {
return str.replace(/\s/g, '-').toLowerCase();
return convertStringToTranslationId(str);
}

getRepresentative(participants: ParticipantSummary[]): ParticipantSummary {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { convertStringToTranslationId } from './translation-id-converter';

describe('convertStringToTranslationId', () => {
it('should return an empty string if input is null', () => {
const result = convertStringToTranslationId(null);
expect(result).toEqual('');
});

it('should return an empty string if input is undefined', () => {
const result = convertStringToTranslationId(undefined);
expect(result).toEqual('');
});

it('should return the correct string to translate id', () => {
const result = convertStringToTranslationId('Insolvency');
expect(result).toBe('insolvency');
});

it('should return the correct string to translate id with spaces', () => {
const result = convertStringToTranslationId('Primary Health Lists');
expect(result).toBe('primary-health-lists');
});

it('should return the correct string to translate id with spaces and special characters', () => {
const result = convertStringToTranslationId('MP’s Expenses');
expect(result).toBe('mp-s-expenses');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export function convertStringToTranslationId(str): string {
if (!str) {
return '';
}
return str.replace(/[\s’']/g, '-').toLowerCase();
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,23 @@ describe('WaitingRoomComponent message and clock', () => {
videoWebService.getConferenceById.calls.reset();
});

describe('stringToTranslateId', () => {
it('should return the correct string to translate id', () => {
const result = component.stringToTranslateId('Insolvency');
expect(result).toBe('insolvency');
});

it('should return the correct string to translate id with spaces', () => {
const result = component.stringToTranslateId('Primary Health Lists');
expect(result).toBe('primary-health-lists');
});

it('should return the correct string to translate id with spaces and special characters', () => {
const result = component.stringToTranslateId('MP’s Expenses');
expect(result).toBe('mp-s-expenses');
});
});

describe('handleParticipantStatusChange', () => {
it('sets isTransferringIn to true when the judge is in hearing', () => {
const judge = component.conference.participants.find(x => x.role === Role.Judge);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { Title } from '@angular/platform-browser';
import { RoomTransfer } from '../../shared/models/room-transfer';
import { HideComponentsService } from '../services/hide-components.service';
import { FocusService } from 'src/app/services/focus.service';
import { convertStringToTranslationId } from 'src/app/shared/translation-id-converter';

@Directive()
export abstract class WaitingRoomBaseDirective implements AfterContentChecked {
Expand Down Expand Up @@ -225,7 +226,7 @@ export abstract class WaitingRoomBaseDirective implements AfterContentChecked {
}

stringToTranslateId(str: string) {
return str.replace(/\s/g, '-').toLowerCase();
return convertStringToTranslationId(str);
}

togglePanel(panelName: string) {
Expand Down
16 changes: 15 additions & 1 deletion VideoWeb/VideoWeb/ClientApp/src/assets/i18n/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,21 @@
"court-of-protections": "Y Llys Gwarchod",
"remo": "REMO",
"maintenance-enforcement": "Gorfodi Cynhaliaeth",
"probate": "Profiant"
"probate": "Profiant",
"transport": "Trafnidiaeth",
"pensions": "Pensiynau",
"social-security-and-child-support": "Nawdd Cymdeithasol a Chynnal Plant",
"civil-enforcement": "Gorfodaeth Sifil",
"insolvency": "Ansolfedd",
"mortgage-and-landlord-possession-claims": "Hawliadau Morgais a Meddiannaeth Landlord",
"non-money-claims": "Hawliadau Anariannol",
"return-of-goods-claims": "Hawliadau Dychwelyd Nwyddau",
"examination-boards": "Byrddau Arholi",
"individual-electoral-registration": "Cofrestru Etholiadol Unigol",
"licensing-and-standards": "Trwyddedu a Safonau",
"primary-health-lists": "Rhestrau Iechyd Sylfaenol",
"mp-s-expenses": "Treuliau ASau",
"agricultural-land-and-drainage": "Tir Amaethyddol a Draenio"
},
"case-role": {
"state": "Y Wladwriaeth",
Expand Down
16 changes: 15 additions & 1 deletion VideoWeb/VideoWeb/ClientApp/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,21 @@
"court-of-protections": "Court of Protections",
"remo": "REMO",
"maintenance-enforcement": "Maintenance Enforcement",
"probate": "Probate"
"probate": "Probate",
"transport": "Transport",
"pensions": "Pensions",
"social-security-and-child-support": "Social Security and Child Support",
"civil-enforcement": "Civil Enforcement",
"insolvency": "Insolvency",
"mortgage-and-landlord-possession-claims": "Mortgage and Landlord Possession Claims",
"non-money-claims": "Non-money Claims",
"return-of-goods-claims": "Return of Goods Claims",
"examination-boards": "Examination Boards",
"individual-electoral-registration": "Individual Electoral Registration",
"licensing-and-standards": "Licensing and Standards",
"primary-health-lists": "Primary Health Lists",
"mp-s-expenses": "MP’s Expenses",
"agricultural-land-and-drainage": "Agricultural Land and Drainage"
},
"case-type-group": {
"state": "State",
Expand Down

0 comments on commit 4b190d7

Please sign in to comment.