(fix)(english) fix loading of pronouns

This commit is contained in:
Valentyne Stigloher 2025-04-18 11:31:05 +02:00
parent f9c0bbfedd
commit a21152d204
5 changed files with 41 additions and 108 deletions

View File

@ -1,10 +1,24 @@
<script setup lang="ts">
interface TableRow {
pronoun: string;
formal?: boolean;
romanised: string;
ipa: string;
meaning: string;
}
defineProps<{
table: TableRow[];
}>();
</script>
<template>
<div class="table-responsive">
<table class="table text-nowrap">
<thead>
<tr>
<th>Japanese</th>
<th v-if="t[0].formal !== undefined">
<th v-if="table[0].formal !== undefined">
Formal?
</th>
<th>Romanised</th>
@ -13,7 +27,7 @@
</tr>
</thead>
<tbody>
<tr v-for="{ pronoun, formal, romanised, ipa, meaning } in t">
<tr v-for="{ pronoun, formal, romanised, ipa, meaning } in table">
<th>
<LinkedText :text="pronoun" />
</th>
@ -34,11 +48,3 @@
</table>
</div>
</template>
<script>
export default {
props: {
t: { required: true },
},
};
</script>

View File

@ -1,3 +1,14 @@
<script setup lang="ts">
import { loadPronouns } from '~/src/data.ts';
defineProps<{
table: Record<string, string>;
}>();
const config = useConfig();
const pronouns = await loadPronouns(config);
</script>
<template>
<div class="table-responsive">
<table class="table text-nowrap">
@ -10,7 +21,7 @@
</tr>
</thead>
<tbody>
<tr v-for="(description, pronoun) in t">
<tr v-for="(description, pronoun) in table">
<th>
<nuxt-link :to="`/${pronouns[pronoun].canonicalName}`">
{{ pronouns[pronoun].name() }}
@ -45,35 +56,3 @@
</table>
</div>
</template>
<script>
import { getPronoun } from '~/src/buildPronoun.ts';
import { loadPronouns } from '~/src/data.ts';
import { buildDict } from '~/src/helpers.ts';
export default {
props: {
t: { required: true },
},
async setup() {
const config = useConfig();
const pronounsList = await loadPronouns(config);
return {
pronounsList,
};
},
data() {
const that = this;
return {
pronouns: buildDict(function* () {
for (const name in that.t) {
if (!Object.hasOwn(that.t, name)) {
continue;
}
yield [name, getPronoun(this.pronounsList, name)];
}
}),
};
},
};
</script>

View File

@ -1,3 +1,9 @@
<script setup lang="ts">
defineProps<{
table: Record<string, string>;
}>();
</script>
<template>
<div class="table-responsive">
<table class="table text-nowrap">
@ -52,35 +58,3 @@
</table>
</div>
</template>
<script>
import { getPronoun } from '~/src/buildPronoun.ts';
import { loadPronouns } from '~/src/data.ts';
import { buildDict } from '~/src/helpers.ts';
export default {
props: {
t: { required: true },
},
async setup() {
const config = useConfig();
const pronounsList = await loadPronouns(config);
return {
pronounsList,
};
},
data() {
const that = this;
return {
pronouns: buildDict(function* () {
for (const name in that.t) {
if (!Object.hasOwn(that.t, name)) {
continue;
}
yield [name, getPronoun(this.pronounsList, name)];
}
}),
};
},
};
</script>

View File

@ -1,3 +1,9 @@
<script setup lang="ts">
defineProps<{
table: Record<string, string>;
}>();
</script>
<template>
<div class="table-responsive">
<table class="table text-nowrap">
@ -52,35 +58,3 @@
</table>
</div>
</template>
<script>
import { getPronoun } from '~/src/buildPronoun.ts';
import { loadPronouns } from '~/src/data.ts';
import { buildDict } from '~/src/helpers.ts';
export default {
props: {
t: { required: true },
},
async setup() {
const config = useConfig();
const pronounsList = await loadPronouns(config);
return {
pronounsList,
};
},
data() {
const that = this;
return {
pronouns: buildDict(function* () {
for (const name in that.t) {
if (!Object.hasOwn(that.t, name)) {
continue;
}
yield [name, getPronoun(this.pronounsList, name)];
}
}),
};
},
};
</script>

View File

@ -48,7 +48,7 @@ const config = useConfig();
<p v-for="p in pronounGroup.description">
<LinkedText :text="p" />
</p>
<EnglishTable v-if="pronounGroup.table" :t="pronounGroup.table" />
<EnglishTable v-if="pronounGroup.table" :table="pronounGroup.table" />
</section>
</Page>
</template>