-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use XBlockI18NService js translations #2
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,14 @@ def _(text): | |
return text | ||
|
||
|
||
def ngettext_fallback(text_singular, text_plural, number): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ahmadabuwardeh Looking at this change it makes sense to have in a separate pull request.
However, I'd like to understand the motivation behind it and if it's crucial for this pull request. |
||
""" Dummy `ngettext` replacement to make string extraction tools scrape strings marked for translation """ | ||
if number == 1: | ||
return text_singular | ||
else: | ||
return text_plural | ||
|
||
|
||
def get_lti_api_base(): | ||
""" | ||
Returns base url to be used as issuer on OAuth2 flows | ||
|
@@ -361,3 +369,11 @@ def model_to_dict(model_object, exclude=None): | |
return object_fields | ||
except (AttributeError, TypeError): | ||
return {} | ||
|
||
|
||
class DummyTranslationService: | ||
""" | ||
Dummy drop-in replacement for i18n XBlock service | ||
""" | ||
gettext = _ | ||
ngettext = ngettext_fallback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahmadabuwardeh thanks again!
Please revert all refactoring changes to this pull request. We only need the
_get_statici18n_js_url
and_get_deprecated_i18n_js_url
.