summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schlachter <t480-debian-git@schlachter.ca>2026-01-11 14:09:13 -0500
committerDavid Schlachter <t480-debian-git@schlachter.ca>2026-01-11 14:09:13 -0500
commit53c51980818258036297986ef3d315c0009ead91 (patch)
treefb5484f9958c7ea2a3d74c84804c86d2b59747af
parent8f308d86f0157584181afadcd3b3f122690eb32a (diff)
Fix genders bug and add number
-rw-r--r--README.md4
-rw-r--r--setup.go23
2 files changed, 21 insertions, 6 deletions
diff --git a/README.md b/README.md
index 2112bee..ee828ac 100644
--- a/README.md
+++ b/README.md
@@ -84,8 +84,8 @@ Usage of french-wiktionary-flashcards:
# TODO
- Include context hints (e.g. see entry for 'panais', which has "Agriculture",
- "Par métonomie", etc) in definitions; and maybe the "singular and plural" box
- as well
+ "Par métonomie", etc) in definitions (tricky because the tags are in english
+ and I would want to display them in the target language).
- allow setting the language for initial processing, so that we could support
languages other than French
- general code cleanup & organization
diff --git a/setup.go b/setup.go
index 7921f47..23c8bbe 100644
--- a/setup.go
+++ b/setup.go
@@ -141,13 +141,28 @@ func populateDictionary(rawDictionary string, db *sql.DB) error {
if len(result.Sounds) > 0 {
entry.Sound = result.Sounds[0].IPA
}
+
+ var genders, numbers []string
for _, r := range result.Tags {
- var genders []string
- if r == "masculine" || r == "feminine" {
- genders = append(genders, r)
+ switch r {
+ case "masculine":
+ genders = append(genders, "masculin")
+ case "feminine":
+ genders = append(genders, "féminin")
+ case "plural":
+ numbers = append(numbers, "pluriel")
+ case "singular":
+ numbers = append(numbers, "singulier")
}
- entry.Gender = strings.Join(genders, " / ")
}
+ entry.Gender = strings.Join(
+ []string{
+ strings.Join(genders, " / "),
+ strings.Join(numbers, " et "),
+ },
+ " ",
+ )
+
for _, s := range result.Senses {
var example string
if len(s.Examples) > 0 {