mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-10-29 18:18:57 +03:00
Add a language argument to LocalizedValue.translate(..)
This commit is contained in:
@@ -172,6 +172,18 @@ class LocalizedValueTestCase(TestCase):
|
||||
with translation.override("nl"):
|
||||
assert localized_value.translate() == "ro"
|
||||
|
||||
@staticmethod
|
||||
def test_translate_custom_language():
|
||||
"""Tests whether the :see:LocalizedValue class's translate() ignores
|
||||
the active language when one is specified explicitely."""
|
||||
|
||||
localized_value = LocalizedValue(
|
||||
{settings.LANGUAGE_CODE: settings.LANGUAGE_CODE, "ro": "ro"}
|
||||
)
|
||||
|
||||
with translation.override("en"):
|
||||
assert localized_value.translate("ro") == "ro"
|
||||
|
||||
@staticmethod
|
||||
def test_deconstruct():
|
||||
"""Tests whether the :see:LocalizedValue class's :see:deconstruct
|
||||
|
||||
Reference in New Issue
Block a user