Kaynağa Gözat

Specify translation context, so the value can be easily changed in a … (#4012)

Specify translation context, so the value can be easily changed in a project if needed.
master
Voxin Muyli 2 yıl önce
ebeveyn
işleme
993e8a6cb6
No account linked to committer's email address

+ 3
- 3
src/oscar/apps/catalogue/abstract_models.py Dosyayı Görüntüle

21
 from django.utils.safestring import mark_safe
21
 from django.utils.safestring import mark_safe
22
 from django.utils.translation import get_language
22
 from django.utils.translation import get_language
23
 from django.utils.translation import gettext_lazy as _
23
 from django.utils.translation import gettext_lazy as _
24
-from django.utils.translation import pgettext_lazy
24
+from django.utils.translation import pgettext, pgettext_lazy
25
 from treebeard.mp_tree import MP_Node
25
 from treebeard.mp_tree import MP_Node
26
 
26
 
27
 from oscar.core.loading import get_class, get_classes, get_model
27
 from oscar.core.loading import get_class, get_classes, get_model
1145
     @property
1145
     @property
1146
     def _boolean_as_text(self):
1146
     def _boolean_as_text(self):
1147
         if self.value:
1147
         if self.value:
1148
-            return _("Yes")
1149
-        return _("No")
1148
+            return pgettext("Product attribute value", "Yes")
1149
+        return pgettext("Product attribute value", "No")
1150
 
1150
 
1151
     @property
1151
     @property
1152
     def value_as_html(self):
1152
     def value_as_html(self):

+ 0
- 1
tests/integration/catalogue/test_attributes.py Dosyayı Görüntüle

81
         assert attr_val.value_as_text == "No"
81
         assert attr_val.value_as_text == "No"
82
 
82
 
83
 
83
 
84
-
85
 class TestMultiOptionAttributes(TestCase):
84
 class TestMultiOptionAttributes(TestCase):
86
 
85
 
87
     def setUp(self):
86
     def setUp(self):

Loading…
İptal
Kaydet