start translation table code
authorLaurent Mazet <mazet@softndesign.org>
Thu, 13 Jun 2024 21:39:22 +0000 (23:39 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Thu, 13 Jun 2024 21:39:22 +0000 (23:39 +0200)
bag-de.h
bag-es.h
bag-nl.h
constant.c
constant.h
type.h

index 9b05f9c38578e979813db1f894bb7616311ef6b1..fa0dd3f7bd33c5a1eb9583dd17fd9e41e08739c1 100644 (file)
--- a/bag-de.h
+++ b/bag-de.h
@@ -73,6 +73,10 @@ static lettervalue_t _lettervalues_de[NB_LETTERVALUES_DE] = {
 
 static char *_extra_help_de = "a, u, o for AE, UE, OE";
 
+#define NB_TRANSLATIONS_DE 3
+
+static trans_t _trans_table_de[NB_TRANSLATIONS_DE] = { { 'a', "Ä" }, { 'u', "Ü" }, { 'o', "Ö" } };
+
 #endif /*  __BAG_DE__ */
 
 /* vim: set ts=4 sw=4 et: */
index 974f3961071739fa1949ad07d8c30a55312af351..40ddbaa0a9f1d950b02bae15836633a8157b7b29 100644 (file)
--- a/bag-es.h
+++ b/bag-es.h
@@ -71,6 +71,10 @@ static lettervalue_t _lettervalues_es[NB_LETTERVALUES_ES] = {
 
 static char *_extra_help_es = "c, l, n, r for CH, LL, NN, RR";
 
+#define NB_TRANSLATIONS_ES 4
+
+static trans_t _trans_table_es[NB_TRANSLATIONS_ES] = { { 'c', "CH" }, { 'l', "LL" }, { 'n', "Ñ" }, { 'r', "RR" } };
+
 #endif /*  __BAG_ES__ */
 
 /* vim: set ts=4 sw=4 et: */
index cd6794fdf8b147d518347b5bee2e90bbc5bc729c..46c4f74f9fa8ef8e2602ed16c1174d2aca95f178 100644 (file)
--- a/bag-nl.h
+++ b/bag-nl.h
@@ -69,6 +69,10 @@ static lettervalue_t _lettervalues_nl[NB_LETTERVALUES_NL] = {
 
 static char *_extra_help_nl = "i for IJ";
 
+#define NB_TRANSLATIONS_NL 1
+
+static trans_t _trans_table_nl[NB_TRANSLATIONS_NL] = { { 'i', "IJ" } };
+
 #endif /*  __BAG_NL__ */
 
 /* vim: set ts=4 sw=4 et: */
index 0e0b000fa537bb7e892fbdfdc44de3f75d768536..5033a373a3153e216ea1bdc33c3926882cd154c8 100644 (file)
@@ -36,6 +36,8 @@ board_t *getboard (char *name)
 
 static bag_t _bag = {0};
 
+static translation_t _translation = {0};
+
 bag_t *getbag (char *lang)
 {
     bag_t *pt = NULL;
@@ -94,4 +96,24 @@ char *getextrahelp (char *lang)
     return pt;
 }
 
+translation_t *gettranslationtable (char *lang)
+{
+    translation_t *pt = NULL;
+
+    if (strcmp (lang, "de") == 0) {
+        pt = &_translation;
+        pt->nb = NB_TRANSLATIONS_DE;
+        pt->tab = _trans_table_de;
+    } else if (strcmp (lang, "es") == 0) {
+        pt = &_translation;
+        pt->nb = NB_TRANSLATIONS_ES;
+        pt->tab = _trans_table_es;
+    } else if (strcmp (lang, "nl") == 0) {
+        pt = &_translation;
+        pt->nb = NB_TRANSLATIONS_NL;
+        pt->tab = _trans_table_nl;
+    }
+    return pt;
+}
+
 /* vim: set ts=4 sw=4 et: */
index 1d7f0f40862a3ee918f69b92e89506799a8f4142..7d4f4852ebaedd0b6d96b451df793296f55c5695 100644 (file)
@@ -9,6 +9,8 @@ bag_t *getbag (char *lang);
 
 char *getextrahelp (char *lang);
 
+translation_t *gettranslationtable (char *lang);
 #endif /* __CONSTANT_H__ */
 
 /* vim: set ts=4 sw=4 et: */
diff --git a/type.h b/type.h
index 6afcaa7991e05556a89c93a333efb4181544ec6f..7f08b760faddca725c07a84586a98f72cc31fe20 100644 (file)
--- a/type.h
+++ b/type.h
@@ -51,6 +51,16 @@ typedef struct {
     spelling_e *status;
 } word_t;
 
+typedef struct {
+    char tile;
+    char *val;
+} trans_t;
+
+typedef struct {
+    int nb;
+    trans_t *tab;
+} translation_t;
+
 #endif /* __TYPE_H__ */
 
 /* vim: set ts=4 sw=4 et: */