Repository: oppia/oppia

Issue:
[blocked on App Engine search service upgrade] Re-introduce 3-letter language codes for explorations and collections.
For background: In #4277, 3-letter language codes were removed due to a crash in the App Engine search service, which only appears to accept 2-letter language codes. 

This issue is being filed to remind us to upgrade App Engine and reinstate these 3-letter codes by reverting the changes in #4277, but only after the search service is upgraded.

/cc @BenHenning


Discussion:

Resolving patch:
diff --git a/core/domain/collection_domain.py b/core/domain/collection_domain.py
--- a/core/domain/collection_domain.py
+++ b/core/domain/collection_domain.py
@@ -968,13 +968,6 @@ def validate(self, strict=True):
             raise utils.ValidationError(
                 'Invalid language code: %s' % self.language_code)
 
-        # TODO(sll): Remove this check once App Engine supports 3-letter
-        # language codes in search.
-        if len(self.language_code) != 2:
-            raise utils.ValidationError(
-                'Invalid language_code, it should have exactly 2 letters: %s' %
-                self.language_code)
-
         if not isinstance(self.tags, list):
             raise utils.ValidationError(
                 'Expected tags to be a list, received %s' % self.tags)
diff --git a/core/domain/exp_domain.py b/core/domain/exp_domain.py
--- a/core/domain/exp_domain.py
+++ b/core/domain/exp_domain.py
@@ -643,12 +643,6 @@ def validate(self, strict=False):
         if not utils.is_valid_language_code(self.language_code):
             raise utils.ValidationError(
                 'Invalid language_code: %s' % self.language_code)
-        # TODO(sll): Remove this check once App Engine supports 3-letter
-        # language codes in search.
-        if len(self.language_code) != 2:
-            raise utils.ValidationError(
-                'Invalid language_code, it should have exactly 2 letters: %s' %
-                self.language_code)
 
         if not isinstance(self.tags, list):
             raise utils.ValidationError(


Test patch:
diff --git a/core/domain/collection_domain_test.py b/core/domain/collection_domain_test.py
--- a/core/domain/collection_domain_test.py
+++ b/core/domain/collection_domain_test.py
@@ -87,11 +87,6 @@ def test_language_code_validation(self):
         self.collection.language_code = 0
         self._assert_validation_error('Expected language code to be a string')
 
-        # TODO(sll): Remove the next two lines once the App Engine search
-        # service supports 3-letter language codes.
-        self.collection.language_code = 'kab'
-        self._assert_validation_error('it should have exactly 2 letters')
-
         self.collection.language_code = 'xz'
         self._assert_validation_error('Invalid language code')
 
diff --git a/core/domain/exp_domain_test.py b/core/domain/exp_domain_test.py
--- a/core/domain/exp_domain_test.py
+++ b/core/domain/exp_domain_test.py
@@ -481,10 +481,6 @@ def test_validation(self):
         self._assert_validation_error(exploration, 'Invalid language_code')
         exploration.language_code = 'English'
         self._assert_validation_error(exploration, 'Invalid language_code')
-        # TODO(sll): Remove the next two lines once the App Engine search
-        # service supports 3-letter language codes.
-        exploration.language_code = 'kab'
-        self._assert_validation_error(exploration, 'Invalid language_code')
         exploration.language_code = 'en'
         exploration.validate()