Skip to content

Commit

Permalink
fix: Replace dot with underscore in language keys
Browse files Browse the repository at this point in the history
  • Loading branch information
testower committed Oct 29, 2024
1 parent b09f7b7 commit 3d92e0c
Show file tree
Hide file tree
Showing 19 changed files with 475 additions and 477 deletions.
4 changes: 2 additions & 2 deletions src/components/Dialogs/AltNamesDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ class AltNamesDialog extends React.Component {
getNameTypeByLocale(nameType) {
if (altNameConfig.allNameTypes.includes(nameType)) {
return this.props.intl.formatMessage({
id: `altNamesDialog.nameTypes.${nameType}`,
id: `altNamesDialog_nameTypes_${nameType}`,
});
}
}

getLangByLocale(lang) {
if (altNameConfig.languages.includes(lang)) {
return this.props.intl.formatMessage({
id: `altNamesDialog.languages.${lang}`,
id: `altNamesDialog_languages_${lang}`,
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Dialogs/EditAltName.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class EditAltName extends Component {
{altNameConfig.supportedNameTypes.map((type) => (
<MenuItem key={"type-" + type} value={type}>
{formatMessage({
id: `altNamesDialog.nameTypes.${type}`,
id: `altNamesDialog_nameTypes_${type}`,
})}
</MenuItem>
))}
Expand All @@ -125,7 +125,7 @@ class EditAltName extends Component {
{altNameConfig.languages.map((key) => (
<MenuItem key={"lang-" + key} value={key}>
{formatMessage({
id: `altNamesDialog.languages.${key}`,
id: `altNamesDialog_languages_${key}`,
})}
</MenuItem>
))}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Dialogs/NewAltName.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class NewAltName extends Component {
{altNameConfig.supportedNameTypes.map((type, index) => (
<MenuItem key={"type-" + type} value={type}>
{formatMessage({
id: `altNamesDialog.nameTypes.${type}`,
id: `altNamesDialog_nameTypes_${type}`,
})}
</MenuItem>
))}
Expand All @@ -79,7 +79,7 @@ class NewAltName extends Component {
{altNameConfig.languages.map((key, index) => (
<MenuItem key={"lang-" + index} value={key}>
{formatMessage({
id: `altNamesDialog.languages.${key}`,
id: `altNamesDialog_languages_${key}`,
})}
</MenuItem>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/EditStopPage/ColumnFilterPopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ColumnFilterPopover extends React.Component {
/>
}
label={formatMessage({
id: `report.columnNames.${option.id}`,
id: `report_columnNames_${option.id}`,
})}
/>
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/components/EditStopPage/EditStopGeneral.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,12 +479,11 @@ class EditStopGeneral extends React.Component {
publicCode: formatMessage({ id: "publicCode" }),
description: formatMessage({ id: "description" }),
unsaved: formatMessage({ id: "unsaved" }),
undefined: formatMessage({ id: "undefined" }),
none: formatMessage({ id: "none_no" }),
quays: formatMessage({ id: "quays" }),
quayItemName: stopPlace.stopPlaceType
? formatMessage({
id: `stopTypes.${stopPlace.stopPlaceType}.quayItemName`,
id: `stopTypes_${stopPlace.stopPlaceType}_quayItemName`,
})
: null,
capacity: formatMessage({ id: "total_capacity" }),
Expand Down
8 changes: 4 additions & 4 deletions src/components/EditStopPage/ModalitiesMenuItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ModalitiesMenuItems extends React.Component {
return {
submode,
formatted: formatMessage({
id: `stopTypes.${type}.submodes.${
id: `stopTypes_${type}_submodes_${
submode || "unspecified"
}`,
}),
Expand All @@ -92,7 +92,7 @@ class ModalitiesMenuItems extends React.Component {
<span
style={stopTypeMatchingChosen ? chosenStyle : unchosenStyle}
>
{formatMessage({ id: `stopTypes.${type}.name` })}
{formatMessage({ id: `stopTypes_${type}_name` })}
</span>
}
key={"stopType" + index}
Expand Down Expand Up @@ -150,11 +150,11 @@ class ModalitiesMenuItems extends React.Component {
>
{submode &&
formatMessage({
id: `stopTypes.${type}.submodes.${submode}`,
id: `stopTypes_${type}_submodes_${submode}`,
})}
{!submode &&
formatMessage({
id: `stopTypes.${type}.submodes.unspecified`,
id: `stopTypes_${type}_submodes_unspecified`,
})}
</span>
</MenuItem>
Expand Down
7 changes: 3 additions & 4 deletions src/components/EditStopPage/QuayItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class QuayItem extends React.Component {
const sign512 = equipmentHelpers.get512SignEquipment(quay);

const wheelChairHint = formatMessage({
id: `accessibilityAssessments.wheelchairAccess.${wheelchairAccess.toLowerCase()}`,
id: `accessibilityAssessments_wheelchairAccess_${wheelchairAccess.toLowerCase()}`,
});
const ticketMachineHint = ticketMachine
? formatMessage({ id: "ticketMachine" })
Expand All @@ -184,18 +184,17 @@ class QuayItem extends React.Component {
? formatMessage({ id: "transport_sign" })
: formatMessage({ id: "transport_sign_no" });
const stepFreeHint = formatMessage({
id: `accessibilityAssessments.stepFreeAccess.${stepFreeAccess.toLowerCase()}`,
id: `accessibilityAssessments_stepFreeAccess_${stepFreeAccess.toLowerCase()}`,
});
const quayItemName = stopPlaceType
? formatMessage({ id: `stopTypes.${stopPlaceType}.quayItemName` })
? formatMessage({ id: `stopTypes_${stopPlaceType}_quayItemName` })
: null;

const translations = {
name: formatMessage({ id: "name" }),
publicCode: formatMessage({ id: "publicCode" }),
description: formatMessage({ id: "description" }),
unsaved: formatMessage({ id: "unsaved" }),
undefined: formatMessage({ id: "undefined" }),
none: formatMessage({ id: "none_no" }),
quays: formatMessage({ id: "quays" }),
stepFreeAccess: formatMessage({ id: "step_free_access" }),
Expand Down
4 changes: 2 additions & 2 deletions src/components/EditStopPage/StepFreePopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class StepFreePopover extends React.Component {
{displayLabel ? (
<div style={{ maginLeft: 5 }}>
{formatMessage({
id: `accessibilityAssessments.stepFreeAccess.${stepFreeAccess.toLowerCase()}`,
id: `accessibilityAssessments_stepFreeAccess_${stepFreeAccess.toLowerCase()}`,
})}
</div>
) : (
Expand Down Expand Up @@ -111,7 +111,7 @@ class StepFreePopover extends React.Component {
</ListItemIcon>
<ListItemText>
{formatMessage({
id: `accessibilityAssessments.stepFreeAccess.${option.toLowerCase()}`,
id: `accessibilityAssessments_stepFreeAccess_${option.toLowerCase()}`,
})}
</ListItemText>
</MenuItem>
Expand Down
12 changes: 6 additions & 6 deletions src/components/EditStopPage/StopPlaceDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ class StopPlaceDetails extends React.Component {
for (let i = 0; i < weightTypes.length; i++) {
if (weightTypes[i] === weightingValue) {
return this.props.intl.formatMessage({
id: `weightTypes.${weightingValue}`,
id: `weightTypes_${weightingValue}`,
});
}
}

return this.props.intl.formatMessage({ id: `weightTypes.noValue` });
return this.props.intl.formatMessage({ id: `weightTypes_noValue` });
}

handleOpenWeightPopover(event) {
Expand Down Expand Up @@ -348,15 +348,15 @@ class StopPlaceDetails extends React.Component {

if (submode) {
return formatMessage({
id: `stopTypes.${stopPlaceType}.submodes.${submode}`,
id: `stopTypes_${stopPlaceType}_quayItemName`,
});
}

if (stopPlaceType) {
return formatMessage({ id: `stopTypes.${stopPlaceType}.name` });
return formatMessage({ id: `stopTypes_${stopPlaceType}_name` });
}

return formatMessage({ id: `stopTypes.unknown` });
return formatMessage({ id: `stopTypes_unknown` });
}

render() {
Expand Down Expand Up @@ -415,7 +415,7 @@ class StopPlaceDetails extends React.Component {
const versionLabel = formatMessage({ id: "version" });
const keyValuesHint = formatMessage({ id: "key_values_hint" });
const wheelChairHint = formatMessage({
id: `accessibilityAssessments.wheelchairAccess.${wheelchairAccess.toLowerCase()}`,
id: `accessibilityAssessments_wheelchairAccess_${wheelchairAccess.toLowerCase()}`,
});
const ticketMachineHint = ticketMachine
? formatMessage({ id: "ticketMachine" })
Expand Down
2 changes: 1 addition & 1 deletion src/components/EditStopPage/WeightingPopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class WeightingPopover extends React.Component {
<MdTransfer style={{ color: weightColors[type] || "grey" }} />
</ListItemIcon>
<ListItemText>
{formatMessage({ id: `weightTypes.${type}` })}
{formatMessage({ id: `weightTypes_${type}` })}
</ListItemText>
</MenuItem>
))}
Expand Down
4 changes: 2 additions & 2 deletions src/components/EditStopPage/WheelChairPopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class WheelChairPopover extends React.Component {
{displayLabel ? (
<div style={{ maginLeft: 5 }}>
{formatMessage({
id: `accessibilityAssessments.wheelchairAccess.${wheelchairAccess.toLowerCase()}`,
id: `accessibilityAssessments_wheelchairAccess_${wheelchairAccess.toLowerCase()}`,
})}
</div>
) : (
Expand Down Expand Up @@ -111,7 +111,7 @@ class WheelChairPopover extends React.Component {
</ListItemIcon>
<ListItemText>
{formatMessage({
id: `accessibilityAssessments.wheelchairAccess.${option.toLowerCase()}`,
id: `accessibilityAssessments_wheelchairAccess_${option.toLowerCase()}`,
})}
</ListItemText>
</MenuItem>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Map/MarkerList.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ const getLocaleStopTypeName = (stopPlaceType, intl) => {
if (stopPlaceType) {
const { formatMessage } = intl;
const formattedStopTypeId = formatMessage({
id: `stopTypes.${stopPlaceType}.quayItemName`,
id: `stopTypes_${stopPlaceType}_quayItemName`,
});
return formatMessage({ id: formattedStopTypeId || "name" });
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportPage/ReportQuayRows.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ReportQuayRows extends React.Component {
<div style={{ display: "flex", fontWeight: 600, paddingLeft: 10 }}>
{columns.map((column, i) => (
<div key={"quay-column-" + i} style={columnStyle}>
{formatMessage({ id: `report.columnNames.${column}` })}
{formatMessage({ id: `report_columnNames_${column}` })}
</div>
))}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportPage/ReportResultView.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class ReportResultView extends React.Component {
<div style={{ display: "flex", fontWeight: 600, paddingLeft: 10 }}>
{columns.map((column, i) => (
<div key={"column-" + column} style={columnStyle}>
{formatMessage({ id: `report.columnNames.${column}` })}
{formatMessage({ id: `report_columnNames_${column}` })}
</div>
))}
<div key={"column-expand"} style={columnStyle} />
Expand Down
4 changes: 2 additions & 2 deletions src/models/columnTransformers.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const getParkingType = (parking, formatMessage) => {
const pedalCycle = "pedalCycle";
const carParking = "car";
const unknownParking = formatMessage({
id: "report.columnNames.notAssigned",
id: "report_columnNames_notAssigned",
});
const iconStyle = {
borderRadius: "50%",
Expand Down Expand Up @@ -163,7 +163,7 @@ export const ColumnTransformerStopPlaceJsx = {
position: (stop, formatMessage) =>
stop.location
? stop.location.join(",")
: formatMessage({ id: "report.columNames.notAssigned" }),
: formatMessage({ id: "report_columNames_notAssigned" }),
quays: (stop) => (stop.quays ? stop.quays.length : 0),
parking: (stop, formatMessage) =>
getParkingElements(stop.parking, formatMessage),
Expand Down
Loading

0 comments on commit 3d92e0c

Please sign in to comment.