mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 04:55:44 +00:00
Translation stat fix (#5250)
* Add helper function for translation coverage - Handle case where locale name does not match exactly * remove debug statement * Fixes
This commit is contained in:
@ -10,9 +10,21 @@ from django.templatetags.i18n import TranslateNode
|
||||
|
||||
import bleach
|
||||
|
||||
import InvenTree.translation
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def translation_stats(lang_code):
|
||||
"""Return the translation percentage for the given language code"""
|
||||
|
||||
if lang_code is None:
|
||||
return None
|
||||
|
||||
return InvenTree.translation.get_translation_percent(lang_code)
|
||||
|
||||
|
||||
class CustomTranslateNode(TranslateNode):
|
||||
"""Custom translation node class, which sanitizes the translated strings for javascript use"""
|
||||
|
||||
|
Reference in New Issue
Block a user