Преглед изворни кода

[mlstring] Mise à jour des todo avec le process à implémenter

On se base sur gettext, mais avec l'utilisation d'une langue par défaut qui sera obligatoire lors de la création de la chaine.
Roland Haroutiounian пре 10 година
родитељ
комит
a86bbfbd49
1 измењених фајлова са 3 додато и 2 уклоњено
  1. 3
    2
      Lodel/utils/mlstring.py

+ 3
- 2
Lodel/utils/mlstring.py Прегледај датотеку

@@ -4,6 +4,7 @@ import json
4 4
 
5 5
 
6 6
 ## Handle string with translations
7
+# @todo define a default language that will be used in case the wanted language is not available for this string (gettext-like behavior)
7 8
 class MlString(object):
8 9
 
9 10
     ## Instanciate a new string with translation
@@ -16,7 +17,7 @@ class MlString(object):
16 17
     # @param lang str: The lang
17 18
     # @return An empty string if the wanted lang don't exist
18 19
     # @warning Returns an empty string if the wanted translation didn't exists
19
-    # @todo Raise an exception if not exists ?
20
+    # @todo if the asked language is not available, use the default one, defined as a class property
20 21
     def get(self, lang):
21 22
         if not lang in self.translations:
22 23
             return ''
@@ -26,6 +27,7 @@ class MlString(object):
26 27
     ## Set a translation for this MlString
27 28
     # @param lang str: The language
28 29
     # @param text str: The translation
30
+    # @todo check if the default language as a translation
29 31
     def set(self, lang, text):
30 32
         if not text:
31 33
             if lang in self.translations:
@@ -67,4 +69,3 @@ class MlString(object):
67 69
         else:
68 70
             translations = dict()
69 71
         return MlString(translations)
70
-

Loading…
Откажи
Сачувај