Skip to content

Commit 9dda5c8

Browse files
authored
Merge pull request #445 from PRUNplanner/improve-i18n-localize-plan
improve(i18n): localize plan
2 parents 4fca0d2 + ef7c55e commit 9dda5c8

28 files changed

Lines changed: 1175 additions & 313 deletions

src/features/government/components/PlanetPOPRButton.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<script setup lang="ts">
22
import { ref, Ref, computed } from "vue";
33
4+
import { useI18n } from "vue-i18n";
5+
const { t } = useI18n();
6+
47
// Composables
58
import { useQuery } from "@/lib/query_cache/useQuery";
69
import { trackEvent } from "@/lib/analytics/useAnalytics";
@@ -53,7 +56,9 @@
5356
}
5457
5558
const compButtonText = computed(() =>
56-
!buttonDisabled.value ? buttonText : "No POPR"
59+
!buttonDisabled.value
60+
? buttonText
61+
: t("government.popr_button.buttons.no_popr")
5762
);
5863
5964
const buttonType = computed(() =>

src/features/government/components/PlanetPOPRTable.vue

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,39 +48,47 @@
4848

4949
<template>
5050
<div v-if="!poprData" class="text-center">
51-
Planet {{ planetNaturalId }} has no population data.
51+
{{
52+
$t("government.popr_button.no_data", { planet_id: planetNaturalId })
53+
}}
5254
</div>
5355

5456
<PTable v-if="poprData" striped>
5557
<thead>
5658
<tr>
5759
<th></th>
58-
<th>Pioneer</th>
59-
<th>Settler</th>
60-
<th>Technician</th>
61-
<th>Engineer</th>
62-
<th>Scientist</th>
60+
<th>{{ $t("game.workforce_type.pioneer") }}</th>
61+
<th>{{ $t("game.workforce_type.settler") }}</th>
62+
<th>{{ $t("game.workforce_type.technician") }}</th>
63+
<th>{{ $t("game.workforce_type.engineer") }}</th>
64+
<th>{{ $t("game.workforce_type.scientist") }}</th>
6365
</tr>
6466
</thead>
6567
<tbody>
6668
<tr>
67-
<td class="font-bold">Total Population</td>
69+
<td class="font-bold">
70+
{{ $t("government.popr_button.table.total_population") }}
71+
</td>
6872
<td>{{ formatAmount(poprData.next_population_pioneer) }}</td>
6973
<td>{{ formatAmount(poprData.next_population_settler) }}</td>
7074
<td>{{ formatAmount(poprData.next_population_technician) }}</td>
7175
<td>{{ formatAmount(poprData.next_population_engineer) }}</td>
7276
<td>{{ formatAmount(poprData.next_population_scientist) }}</td>
7377
</tr>
7478
<tr>
75-
<td class="font-bold">Free Population</td>
79+
<td class="font-bold">
80+
{{ $t("government.popr_button.table.free_population") }}
81+
</td>
7682
<td>{{ formatAmount(poprData.free_pioneer) }}</td>
7783
<td>{{ formatAmount(poprData.free_settler) }}</td>
7884
<td>{{ formatAmount(poprData.free_technician) }}</td>
7985
<td>{{ formatAmount(poprData.free_engineer) }}</td>
8086
<td>{{ formatAmount(poprData.free_scientist) }}</td>
8187
</tr>
8288
<tr>
83-
<td class="font-bold">Free Population %</td>
89+
<td class="font-bold">
90+
{{ $t("government.popr_button.table.free_population_pct") }}
91+
</td>
8492
<td>
8593
{{ formatNumber(poprData.unemployment_rate_pioneer * 100) }}
8694
</td>
@@ -106,7 +114,9 @@
106114
</td>
107115
</tr>
108116
<tr>
109-
<td class="font-bold">Unfilled Jobs</td>
117+
<td class="font-bold">
118+
{{ $t("government.popr_button.table.unfilled_jobs") }}
119+
</td>
110120
<td>{{ formatAmount(poprData.open_jobs_pioneer) }}</td>
111121
<td>{{ formatAmount(poprData.open_jobs_settler) }}</td>
112122
<td>{{ formatAmount(poprData.open_jobs_technician) }}</td>
@@ -115,7 +125,9 @@
115125
</tr>
116126
<template v-if="workforceData">
117127
<tr class="child:border-t-2! child:border-t-white/20!">
118-
<td class="font-bold">Plan Need</td>
128+
<td class="font-bold">
129+
{{ $t("government.popr_button.table.plan_need") }}
130+
</td>
119131
<td>{{ formatAmount(workforceData.pioneer.required) }}</td>
120132
<td>{{ formatAmount(workforceData.settler.required) }}</td>
121133
<td>
@@ -127,7 +139,9 @@
127139
</td>
128140
</tr>
129141
<tr>
130-
<td class="font-bold">Plan Check</td>
142+
<td class="font-bold">
143+
{{ $t("government.popr_button.table.plan_check") }}
144+
</td>
131145
<td>
132146
<PIcon>
133147
<component

src/features/planning/components/PlanArea.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<script setup lang="ts">
22
import { computed, PropType, WritableComputedRef } from "vue";
3+
4+
import { useI18n } from "vue-i18n";
5+
const { t } = useI18n();
6+
37
import { trackEvent } from "@/lib/analytics/useAnalytics";
48
59
// Types & Interfaces
@@ -42,7 +46,7 @@
4246

4347
<template>
4448
<PForm>
45-
<PFormItem label="Permits">
49+
<PFormItem :label="t('plan.components.area.permits')">
4650
<PInputNumber
4751
v-model:value="localPermits"
4852
:disabled="disabled"
@@ -51,7 +55,7 @@
5155
:max="3"
5256
class="w-full" />
5357
</PFormItem>
54-
<PFormItem label="Area">
58+
<PFormItem :label="t('plan.components.area.area')">
5559
<div class="flex flex-row w-full">
5660
<div class="grow">
5761
{{ areaData.areaUsed }} / {{ areaData.areaTotal }}
@@ -66,7 +70,7 @@
6670
"
6771
>{{ areaData.areaLeft }}</span
6872
>
69-
Free
73+
{{ $t("plan.components.area.free") }}
7074
</div>
7175
</div>
7276
</PFormItem>

src/features/planning/components/PlanBonuses.vue

Lines changed: 60 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<script setup lang="ts">
22
import { computed, PropType, WritableComputedRef } from "vue";
3+
4+
import { useI18n } from "vue-i18n";
5+
const { t } = useI18n();
6+
37
import { trackEvent } from "@/lib/analytics/useAnalytics";
48
// Types & Interfaces
59
import { PLAN_COGCPROGRAM_TYPE } from "@/stores/planningStore.types";
@@ -55,40 +59,75 @@
5559
},
5660
});
5761
58-
const cogcOptions: PSelectOption[] = [
59-
{ value: "---", label: "None" },
60-
{ value: "AGRICULTURE", label: "Agriculture" },
61-
{ value: "CHEMISTRY", label: "Chemistry" },
62-
{ value: "CONSTRUCTION", label: "Construction" },
63-
{ value: "ELECTRONICS", label: "Electronics" },
64-
{ value: "FOOD_INDUSTRIES", label: "Food Industries" },
65-
{ value: "FUEL_REFINING", label: "Fuel Refining" },
66-
{ value: "MANUFACTURING", label: "Manufacturing" },
67-
{ value: "METALLURGY", label: "Metallurgy" },
68-
{ value: "RESOURCE_EXTRACTION", label: "Resource Extraction" },
69-
{ value: "PIONEERS", label: "Pioneers" },
70-
{ value: "SETTLERS", label: "Settlers" },
71-
{ value: "TECHNICIANS", label: "Technicians" },
72-
{ value: "ENGINEERS", label: "Engineers" },
73-
{ value: "SCIENTISTS", label: "Scientists" },
74-
];
62+
const cogcOptions = computed<PSelectOption[]>(() => [
63+
{ value: "---", label: t("game.cogc_program.NONE") },
64+
{
65+
value: "AGRICULTURE",
66+
label: t("game.cogc_program.ADVERTISING_AGRICULTURE"),
67+
},
68+
{
69+
value: "CHEMISTRY",
70+
label: t("game.cogc_program.ADVERTISING_CHEMISTRY"),
71+
},
72+
{
73+
value: "CONSTRUCTION",
74+
label: t("game.cogc_program.ADVERTISING_CONSTRUCTION"),
75+
},
76+
{
77+
value: "ELECTRONICS",
78+
label: t("game.cogc_program.ADVERTISING_ELECTRONICS"),
79+
},
80+
{
81+
value: "FOOD_INDUSTRIES",
82+
label: t("game.cogc_program.ADVERTISING_FOOD_INDUSTRIES"),
83+
},
84+
{
85+
value: "FUEL_REFINING",
86+
label: t("game.cogc_program.ADVERTISING_FUEL_REFINING"),
87+
},
88+
{
89+
value: "MANUFACTURING",
90+
label: t("game.cogc_program.ADVERTISING_MANUFACTURING"),
91+
},
92+
{
93+
value: "METALLURGY",
94+
label: t("game.cogc_program.ADVERTISING_METALLURGY"),
95+
},
96+
{
97+
value: "RESOURCE_EXTRACTION",
98+
label: t("game.cogc_program.ADVERTISING_RESOURCE_EXTRACTION"),
99+
},
100+
{ value: "PIONEERS", label: t("game.cogc_program.WORKFORCE_PIONEERS") },
101+
{ value: "SETTLERS", label: t("game.cogc_program.WORKFORCE_SETTLERS") },
102+
{
103+
value: "TECHNICIANS",
104+
label: t("game.cogc_program.WORKFORCE_TECHNICIANS"),
105+
},
106+
{
107+
value: "ENGINEERS",
108+
label: t("game.cogc_program.WORKFORCE_ENGINEERS"),
109+
},
110+
{
111+
value: "SCIENTISTS",
112+
label: t("game.cogc_program.WORKFORCE_SCIENTISTS"),
113+
},
114+
]);
75115
</script>
76116

77117
<template>
78118
<PForm>
79-
<PFormItem label="Corp. HQ">
119+
<PFormItem :label="t('plan.components.bonuses.corp_hq')">
80120
<PTooltip>
81121
<template #trigger>
82122
<PCheckbox
83123
v-model:checked="localCorpHQ"
84124
:disabled="disabled" />
85125
</template>
86-
The corporation you belong to has its headquarters on <br />
87-
this planet (not your individual company).
126+
{{ $t("plan.components.bonuses.corp_hq_tooltip") }}
88127
</PTooltip>
89128
</PFormItem>
90129

91-
<PFormItem label="COGC">
130+
<PFormItem :label="t('plan.components.bonuses.cogc')">
92131
<PSelect
93132
v-model:value="localCOGC"
94133
class="w-full"

src/features/planning/components/PlanConfiguration.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<script setup lang="ts">
22
import { computed, ComputedRef, PropType, WritableComputedRef } from "vue";
33
4+
import { useI18n } from "vue-i18n";
5+
const { t } = useI18n();
6+
47
// Types & Interfaces
58
import { IPlanEmpire } from "@/stores/planningStore.types";
69
import { PSelectOption } from "@/ui/ui.types";
@@ -85,14 +88,14 @@
8588

8689
<template>
8790
<PForm>
88-
<PFormItem label="Name">
91+
<PFormItem :label="t('plan.components.configuration.name')">
8992
<PInput
9093
v-model:value="localPlanName"
9194
class="w-full"
9295
:disabled="disabled"
9396
placeholder="Plan Name" />
9497
</PFormItem>
95-
<PFormItem label="Empire">
98+
<PFormItem :label="t('plan.components.configuration.empire')">
9699
<PSelect
97100
v-model:value="localActiveEmpireUuid"
98101
class="w-full"

src/features/planning/components/PlanExperts.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
1111
// Util
1212
import { formatNumber } from "@/util/numbers";
13-
import { capitalizeString } from "@/util/text";
1413
1514
// UI
1615
import { PInputNumber } from "@/ui";
@@ -52,13 +51,18 @@
5251

5352
<template>
5453
<div v-if="totalExperts > 6" class="bg-red-500/50 p-2 mb-3">
55-
Maximum number of experts on a base is 6. You currently have
56-
{{ totalExperts }} experts assigned.
54+
{{
55+
$t("plan.components.experts.warning", {
56+
expert_number: totalExperts,
57+
})
58+
}}
5759
</div>
5860
<div
5961
class="grid grid-cols-[repeat(3,auto)] sm:grid-cols-[repeat(6,auto)] gap-3 child:my-auto">
6062
<template v-for="expert in expertData" :key="expert.name">
61-
<div>{{ capitalizeString(expert.name) }}</div>
63+
<div>
64+
{{ $t(`game.expertise.${expert.name.toUpperCase()}`) }}
65+
</div>
6266
<PInputNumber
6367
v-model:value="localExpertData[expert.name].amount"
6468
:disabled="disabled"

src/features/planning/components/PlanInfrastructure.vue

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<script setup lang="ts">
22
import { computed, ComputedRef, PropType, WritableComputedRef } from "vue";
3+
4+
import { useI18n } from "vue-i18n";
5+
const { t } = useI18n();
6+
37
import { trackEvent } from "@/lib/analytics/useAnalytics";
48
import { HabSolverGoal } from "@/features/planning/calculations/habOptimization";
59
@@ -85,15 +89,19 @@
8589
<template>
8690
<div class="mb-3">
8791
<PForm>
88-
<PFormItem label="Auto-Optimize Habs">
92+
<PFormItem
93+
:label="t('plan.components.infrastructure.auto_optimize')">
8994
<PTooltip>
9095
<template #trigger>
9196
<PCheckbox
9297
v-model:checked="localAutoOptimizeHabs"
9398
:disabled="disabled" />
9499
</template>
95-
Automatically optimize habitations to meet<br />workforce
96-
needs as buildings are added.
100+
{{
101+
$t(
102+
"plan.components.infrastructure.auto_optimize_tooltip"
103+
)
104+
}}
97105
</PTooltip>
98106
</PFormItem>
99107
</PForm>
@@ -103,7 +111,10 @@
103111
<div>{{ inf }}</div>
104112
<PInputNumber
105113
v-model:value="localInfrastructureData[inf]"
106-
:disabled="disabled || (localAutoOptimizeHabs && !isStorageInfrastructure(inf))"
114+
:disabled="
115+
disabled ||
116+
(localAutoOptimizeHabs && !isStorageInfrastructure(inf))
117+
"
107118
show-buttons
108119
:min="0"
109120
class="min-w-21.25 max-w-25"
@@ -124,14 +135,14 @@
124135
<PButton
125136
:disabled="disabled || localAutoOptimizeHabs"
126137
@click="emit('optimize-habs', 'cost')">
127-
Optimize Cost
138+
{{ $t("plan.components.infrastructure.buttons.optimize_cost") }}
128139
</PButton>
129140
</div>
130141
<div class="col-span-2 justify-self-center">
131142
<PButton
132143
:disabled="disabled || localAutoOptimizeHabs"
133144
@click="emit('optimize-habs', 'area')">
134-
Optimize Area
145+
{{ $t("plan.components.infrastructure.buttons.optimize_area") }}
135146
</PButton>
136147
</div>
137148
</div>

0 commit comments

Comments
 (0)