PPLR Religion: the legend names each religion in the reader's language
The family names were typed in English. They now come from the shared religion catalogue (religionFamilyLabel), in the legend, its list and the ready line; the keys and the map filter stay English.
This commit is contained in:
parent
a2a05058c6
commit
e133b480c5
1 changed files with 10 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<script setup>
|
||||
import { dataUrl, glFor, exposeMap, whenGeojsonDrawn, setProjectionFor } from '../utils/pplrData.js'
|
||||
import { usePplrT } from '../composables/usePplrT.js'
|
||||
import { religionFamilyLabel } from '@map/colors/religion.js'
|
||||
import { tStatic } from '@map/i18n/index.js'
|
||||
/**
|
||||
* pplr-religion.vue — PG pins colored by primary religion.
|
||||
|
|
@ -138,6 +139,12 @@ const RELIGION_GROUPS = [
|
|||
{ key: 'other', label: 'Other / Unknown', color: '#4b5563' }, // dark gray
|
||||
]
|
||||
|
||||
// Shown in the reader's language through the shared religion catalogue; the key and the filter stay
|
||||
// English. "Other / Unknown" is one bucket here, so it is named from both catalogue entries.
|
||||
const groupLabel = (g) => (g.key === 'other'
|
||||
? `${religionFamilyLabel('Other')} / ${religionFamilyLabel('Unknown')}`
|
||||
: religionFamilyLabel(g.label))
|
||||
|
||||
const COLOR_EXPR = [
|
||||
'match', ['get', 'rg'],
|
||||
...RELIGION_GROUPS.flatMap(g => [g.key, g.color]),
|
||||
|
|
@ -148,7 +155,7 @@ const COLOR_EXPR = [
|
|||
const religionCounts = ref({})
|
||||
const religionLegendItems = computed(() => RELIGION_GROUPS.map(g => ({
|
||||
key: g.key,
|
||||
label: g.label,
|
||||
label: groupLabel(g),
|
||||
color: g.color,
|
||||
count: religionCounts.value[g.key] || 0,
|
||||
filter: ['==', ['get', 'rg'], g.key],
|
||||
|
|
@ -167,7 +174,7 @@ function onLegendSelect(node) {
|
|||
const religionLocalIndex = computed(() => {
|
||||
const out = RELIGION_GROUPS.map((g, i) => ({
|
||||
id: `rel:${g.key}`,
|
||||
label: g.label,
|
||||
label: groupLabel(g),
|
||||
color: g.color,
|
||||
kind: 'religion',
|
||||
depth: 0,
|
||||
|
|
@ -280,7 +287,7 @@ onMounted(async () => {
|
|||
religionCounts.value = counts
|
||||
const dominant = RELIGION_GROUPS.reduce((a, b) => (counts[a.key] || 0) > (counts[b.key] || 0) ? a : b)
|
||||
// Per user 2026-05-02: drop the "Ready" prefix — it was unclear and chewed up width.
|
||||
status.value = t('pplr.status.readyReligion', { pins: pgData.value.features.length.toLocaleString(), religion: dominant.label, count: (counts[dominant.key]||0).toLocaleString() })
|
||||
status.value = t('pplr.status.readyReligion', { pins: pgData.value.features.length.toLocaleString(), religion: groupLabel(dominant), count: (counts[dominant.key]||0).toLocaleString() })
|
||||
// keep the LoadingGlobe up until the pins are actually drawn, not merely added
|
||||
await whenGeojsonDrawn(map.value)
|
||||
dataReady.value = true
|
||||
|
|
|
|||
Loading…
Reference in a new issue