Skip to content

Commit

Permalink
feat(cc-pricing-estimation): display non translated features
Browse files Browse the repository at this point in the history
Fixes #796
  • Loading branch information
florian-sanders-cc committed Jul 18, 2023
1 parent 24ec318 commit b7b1093
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/components/cc-pricing-estimation/cc-pricing-estimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,17 @@ export class CcPricingEstimation extends LitElement {
* @return {string|void} the translated feature name if a translation exists or nothing if the translation does not exist
*/
_getFeatureName (feature) {
if (feature != null && FEATURES_I18N[feature.code] != null) {
if (feature == null) {
return '';
}

if (FEATURES_I18N[feature.code] != null) {
return FEATURES_I18N[feature.code]();
}

if (feature.name != null) {
return i18n('cc-pricing-estimation.feature.custom', { featureName: feature.name });
}
}

/**
Expand Down Expand Up @@ -471,16 +479,15 @@ export class CcPricingEstimation extends LitElement {
</summary>
${hasFeatures ? html`
<dl class="plan__features">
${plan.features?.map((feature) => {
if (AVAILABLE_FEATURES.includes(feature.code)) {
${plan.features
?.filter((feature) => AVAILABLE_FEATURES.includes(feature.code) || feature.name != null)
?.map((feature) => {
return html`
<div class="plan__features__feature">
<dt>${this._getFeatureName(feature)}</dt>
<dd>${this._getFeatureValue(feature)}</dd>
</div>
`;
}
return '';
})}
</dl>
` : ''}
Expand Down
1 change: 1 addition & 0 deletions src/translations/translations.en.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ export const translations = {
'cc-pricing-estimation.estimated-price-name.second': `estimated/Second`,
'cc-pricing-estimation.feature.connection-limit': `Connection limit: `,
'cc-pricing-estimation.feature.cpu': `vCPUs: `,
'cc-pricing-estimation.feature.custom': ({ featureName }) => `${featureName}: `,
'cc-pricing-estimation.feature.databases': `Databases: `,
'cc-pricing-estimation.feature.disk-size': `Disk size: `,
'cc-pricing-estimation.feature.gpu': `GPUs: `,
Expand Down
1 change: 1 addition & 0 deletions src/translations/translations.fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ export const translations = {
'cc-pricing-estimation.estimated-price-name.second': `estimé/seconde`,
'cc-pricing-estimation.feature.connection-limit': () => sanitize`Limite de connexions&nbsp;: `,
'cc-pricing-estimation.feature.cpu': () => sanitize`vCPUs&nbsp;: `,
'cc-pricing-estimation.feature.custom': ({ featureName }) => sanitize`${featureName}&nbsp;: `,
'cc-pricing-estimation.feature.databases': () => sanitize`Bases de données&nbsp;: `,
'cc-pricing-estimation.feature.disk-size': () => sanitize`Taille du disque&nbsp;: `,
'cc-pricing-estimation.feature.gpu': () => sanitize`GPUs&nbsp;: `,
Expand Down

0 comments on commit b7b1093

Please sign in to comment.