Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few more item groups #160

Merged
merged 1 commit into from
May 15, 2024
Merged
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
2 changes: 2 additions & 0 deletions src/i18n/strings/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const templates = {
s025c15001425a689: `reemplazo de ventanas`,
s04009ba1826b5fca: `Idaho`,
s04c4b18eb3941d37: `California`,
s07607bad0f288304: `reemplazo de puertas y ventanas`,
s07ecbff17886eb50: `un vehículo eléctrico usado`,
s08fb6007b5965c82: `Vehículo eléctrico`,
s0ec469a91a15f4a5: `kilovatio hora`,
Expand Down Expand Up @@ -95,6 +96,7 @@ export const templates = {
s6ef16f759a2cea7e: `Nevada`,
s70fd14cbb0ad4160: `Continúe para ver otros incentivos.`,
s751ba5ac47cbfabb: `Washington`,
s7709947cefee8560: `una auditoría energética y impermeabilización`,
s777612e8117ff021: `Tennessee`,
s79fd9ba9e498d3da: str`${0} del costo de ${1}, hasta \$${2}`,
s7a73c90a7c3b43b4: `un calentador de agua con bomba de calor`,
Expand Down
65 changes: 41 additions & 24 deletions src/item-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,33 @@ type ItemGroup =
| 'plugin_hybrid'
| 'new_vehicle'
| 'used_vehicle'
| 'door_and_window'
| 'insulation'
| 'weatherization'
| 'audit_and_weatherization'
| 'water_heater';

const ALL_INSULATION: ItemType[] = [
'attic_or_roof_insulation',
'basement_insulation',
'crawlspace_insulation',
'floor_insulation',
'other_insulation',
'wall_insulation',
];

const ALL_WEATHERIZATION: ItemType[] = [
...ALL_INSULATION,
'air_sealing',
'door_replacement',
'duct_replacement',
'duct_sealing',
'weatherization',
'window_replacement',
'efficiency_rebates',
'other_weatherization',
];

/**
* Some incentives are for multiple items. These groups define headlines for
* such incentives: if the incentive's items are a subset of one of these
Expand Down Expand Up @@ -67,35 +90,21 @@ const ITEM_GROUPS: { group: ItemGroup; members: Set<ItemType> }[] = [
group: 'used_vehicle',
members: new Set(['used_electric_vehicle', 'used_plugin_hybrid_vehicle']),
},
{
group: 'door_and_window',
members: new Set(['door_replacement', 'window_replacement']),
},
{
group: 'insulation',
members: new Set([
'attic_or_roof_insulation',
'basement_insulation',
'crawlspace_insulation',
'floor_insulation',
'other_insulation',
'wall_insulation',
]),
members: new Set(ALL_INSULATION),
},
{
group: 'weatherization',
members: new Set([
'air_sealing',
'attic_or_roof_insulation',
'basement_insulation',
'crawlspace_insulation',
'door_replacement',
'duct_replacement',
'duct_sealing',
'floor_insulation',
'wall_insulation',
'weatherization',
'window_replacement',
'efficiency_rebates',
'other_insulation',
'other_weatherization',
]),
members: new Set(ALL_WEATHERIZATION),
},
{
group: 'audit_and_weatherization',
members: new Set([...ALL_WEATHERIZATION, 'energy_audit']),
},
{
group: 'water_heater',
Expand Down Expand Up @@ -139,12 +148,20 @@ const multipleItemsName = (items: ItemType[], msg: MsgFn) => {
});
case 'generic_heat_pump':
return msg('a heat pump', { desc: 'e.g. "$100 off [this string]"' });
case 'door_and_window':
return msg('door and window replacement', {
desc: 'e.g. "$100 off [this string]"',
});
case 'insulation':
return msg('insulation', { desc: 'e.g. "$100 off [this string]"' });
case 'weatherization':
return msg('weatherization', {
desc: 'e.g. "$100 off [this string]"',
});
case 'audit_and_weatherization':
return msg('an energy audit and weatherization', {
desc: 'e.g. "$100 off [this string]"',
});
case 'water_heater':
return msg('a water heater', {
desc: 'e.g. "$100 off [this string]"',
Expand Down
4 changes: 3 additions & 1 deletion test/item-names.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ describe('group names', () => {
expect(itemName(['wall_insulation', 'other_weatherization'], msg)).toBe(
'weatherization',
);
expect(itemName(['other_weatherization', 'energy_audit'], msg)).toBeNull();
expect(itemName(['other_weatherization', 'energy_audit'], msg)).toBe(
'an energy audit and weatherization',
);
});

test('vehicles', () => {
Expand Down
10 changes: 10 additions & 0 deletions translations/es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,16 @@
<target>un vehículo usado</target>
<note from="lit-localize">e.g. "$100 off [this string]"</note>
</trans-unit>
<trans-unit id="s07607bad0f288304">
<source>door and window replacement</source>
<target>reemplazo de puertas y ventanas</target>
<note from="lit-localize">e.g. "$100 off [this string]"</note>
</trans-unit>
<trans-unit id="s7709947cefee8560">
<source>an energy audit and weatherization</source>
<target>una auditoría energética y impermeabilización</target>
<note from="lit-localize">e.g. "$100 off [this string]"</note>
</trans-unit>
</body>
</file>
</xliff>
Loading