summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 {