From 54c1fdb23e6c87eb36b8f7bfe40057c68793e058 Mon Sep 17 00:00:00 2001 From: Mritunjai <101278178+Mritunjaii@users.noreply.github.com> Date: Thu, 12 Sep 2024 18:15:59 +0530 Subject: [PATCH 1/2] Update test_commands.py .text() is deprecated use read_text instead --- common/djangoapps/xblock_django/tests/test_commands.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/djangoapps/xblock_django/tests/test_commands.py b/common/djangoapps/xblock_django/tests/test_commands.py index 322ee9384f37..7e339d8be9ec 100644 --- a/common/djangoapps/xblock_django/tests/test_commands.py +++ b/common/djangoapps/xblock_django/tests/test_commands.py @@ -64,7 +64,8 @@ def test_compile_xblock_translations(tmp_translations_dir): 'msgfmt', '--check-format', '-o', str(po_file.with_suffix('.mo')), str(po_file), ], 'Compiles the .po files' - js_file_text = get_javascript_i18n_file_path('done', 'tr').text() + # js_file_text = get_javascript_i18n_file_path('done', 'tr').text() + js_file_text = get_javascript_i18n_file_path('done', 'tr').read_text() assert 'Merhaba' in js_file_text, 'Ensures the JavaScript catalog is compiled' assert 'TestingDoneXBlockI18n' in js_file_text, 'Ensures the namespace is used' assert 'gettext' in js_file_text, 'Ensures the gettext function is defined' From fb5d5f08a910add045d22a5160f474d6a9a31fda Mon Sep 17 00:00:00 2001 From: Mritunjai <101278178+Mritunjaii@users.noreply.github.com> Date: Thu, 12 Sep 2024 18:20:03 +0530 Subject: [PATCH 2/2] Update translation.py .listdir is deprecated; use iterdir instead. --- common/djangoapps/xblock_django/translation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/djangoapps/xblock_django/translation.py b/common/djangoapps/xblock_django/translation.py index 72726221aac1..73ed3bfdc587 100644 --- a/common/djangoapps/xblock_django/translation.py +++ b/common/djangoapps/xblock_django/translation.py @@ -101,7 +101,8 @@ def compile_xblock_js_messages(): xblock_conf_locale_dir = xmodule_api.get_python_locale_root() / xblock_module i18n_js_namespace = xblock_class.get_i18n_js_namespace() - for locale_dir in xblock_conf_locale_dir.listdir(): + # for locale_dir in xblock_conf_locale_dir.listdir(): + for locale_dir in xblock_conf_locale_dir.iterdir(): locale_code = str(locale_dir.basename()) locale_messages_dir = locale_dir / 'LC_MESSAGES' js_translations_domain = None