Skip to content

Commit

Permalink
chore: Adds support of i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan committed Jan 29, 2025
1 parent 6b3b0e2 commit a43d3ea
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions xblocks_contrib/word_cloud/word_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
If student does not yet answered - `num_inputs` numbers of text inputs.
If student have answered - words he entered and cloud.
"""
import json
import uuid

from django.utils.translation import gettext_noop as _
from web_fragments.fragment import Fragment
from xblock.core import XBlock
from xblock.fields import Boolean, Dict, Integer, List, Scope, String
Expand All @@ -17,15 +17,6 @@
resource_loader = ResourceLoader(__name__)


# Make '_' a no-op so we can scrape strings. Using lambda instead of
# `django.utils.translation.ugettext_noop` because Django cannot be imported in this file
def noop(text):
return text


_ = noop


def pretty_bool(value):
"""Check value for possible `True` value.
Expand All @@ -36,6 +27,7 @@ def pretty_bool(value):
return value in bool_dict

Check warning on line 27 in xblocks_contrib/word_cloud/word_cloud.py

View check run for this annotation

Codecov / codecov/patch

xblocks_contrib/word_cloud/word_cloud.py#L26-L27

Added lines #L26 - L27 were not covered by tests


@XBlock.needs("i18n")
class WordCloudBlock(StudioEditableXBlockMixin, XBlock):
"""
Word Cloud XBlock.
Expand Down Expand Up @@ -138,8 +130,7 @@ def student_view(self, context=None): # pylint: disable=W0613
'range_num_inputs': range(self.num_inputs),
'submitted': self.submitted,
},
# TODO: Add i188n
# i18n_service = self.runtime.service(self, 'i18n')
i18n_service=self.runtime.service(self, 'i18n')
))
frag.add_css(resource_loader.load_unicode("static/css/word_cloud.css"))
frag.add_javascript(resource_loader.load_unicode("static/js/src/word_cloud.js"))
Expand Down

0 comments on commit a43d3ea

Please sign in to comment.