diff --git a/frontend/js/orthography.js b/frontend/js/orthography.js index 8773cbbee..32ebb5805 100644 --- a/frontend/js/orthography.js +++ b/frontend/js/orthography.js @@ -8,6 +8,8 @@ const AVAILABLE_ORTHOGRAPHIES = new Set([ "Latn", "Latn-x-macron", "CMRO", + "Standardized", + "Original", ]); /** diff --git a/src/CreeDictionary/CreeDictionary/templates/CreeDictionary/components/definition__elaboration.html b/src/CreeDictionary/CreeDictionary/templates/CreeDictionary/components/definition__elaboration.html index a28476c0d..0b81418a3 100644 --- a/src/CreeDictionary/CreeDictionary/templates/CreeDictionary/components/definition__elaboration.html +++ b/src/CreeDictionary/CreeDictionary/templates/CreeDictionary/components/definition__elaboration.html @@ -38,12 +38,12 @@ {% if show_ic != "no" %} {{ lemma.inflectional_category }} {% endif %} + {% if lemma.show_emoji %} + + {{ emoji }}   + + {% endif %} {% if display_options.mode == 'linguistic' %} - {% if lemma.show_emoji %} - - {{ emoji }}   - - {% endif %} {% if lemma.inflectional_category_linguistic %} {{ lemma.inflectional_category_linguistic }} ({{ lemma.inflectional_category }}) @@ -58,11 +58,6 @@ {% endif %} {% if display_options.mode == 'english' %} - {% if lemma.show_emoji %} - - {{ emoji }}   - - {% endif %} {% if lemma.inflectional_category_linguistic %} {% relabel_plain_english lemma.inflectional_category %} @@ -77,11 +72,6 @@ {% endif %} {% if display_options.mode == 'source_language' %} - {% if lemma.show_emoji %} - - {{ emoji }}   - - {% endif %} {% if lemma.inflectional_category_linguistic %} {% relabel_source lemma.inflectional_category %} diff --git a/src/CreeDictionary/CreeDictionary/templates/CreeDictionary/components/search-result.html b/src/CreeDictionary/CreeDictionary/templates/CreeDictionary/components/search-result.html index 5b9477c9c..771bc3bf4 100644 --- a/src/CreeDictionary/CreeDictionary/templates/CreeDictionary/components/search-result.html +++ b/src/CreeDictionary/CreeDictionary/templates/CreeDictionary/components/search-result.html @@ -57,7 +57,7 @@ {# These are the definitions for the inflection (non-lemma), could be empty #}
    {% for def in result.definitions %} -
  1. {{ def.text }} +
  2. {% convert def.text %} {% include "CreeDictionary/components/citations.html" with dictionary_sources=def.source_ids %}
  3. {% endfor %} diff --git a/src/CreeDictionary/morphodict/templatetags/morphodict_orth.py b/src/CreeDictionary/morphodict/templatetags/morphodict_orth.py index e7f22075e..478af3496 100644 --- a/src/CreeDictionary/morphodict/templatetags/morphodict_orth.py +++ b/src/CreeDictionary/morphodict/templatetags/morphodict_orth.py @@ -2,6 +2,7 @@ from django.conf import settings from django.utils.html import format_html +from morphodict.lexicon.models import Definition from ..orthography import ORTHOGRAPHY register = template.Library() @@ -74,3 +75,25 @@ def current_orthography_name(context): # Determine the currently requested orthography: request_orth = ORTHOGRAPHY.from_request(context.request) return ORTHOGRAPHY.name_of(request_orth) + + +@register.simple_tag(name="convert", takes_context=True) +def convert_to_standardized(context, definition: str): + if settings.MORPHODICT_DICTIONARY_NAME == "Lacombe": + orth = context.request.COOKIES.get("orth") + if orth == "Original": + return definition + d = Definition.objects.filter(text=definition).first() + if not d: + return definition + wf = d.wordform + if not wf: + return definition + + if wf.linguist_info: + if "standardized" in wf.linguist_info: + return wf.linguist_info["standardized"]["senses"][0]["definition"] + else: + return definition + + return definition diff --git a/src/crkLacombeeng/app/__init__.py b/src/crkLacombeeng/app/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/crkLacombeeng/site/settings.py b/src/crkLacombeeng/site/settings.py index 0d3e71bf7..2f91aacfc 100644 --- a/src/crkLacombeeng/site/settings.py +++ b/src/crkLacombeeng/site/settings.py @@ -43,8 +43,9 @@ MORPHODICT_PREVIEW_WARNING = False MORPHODICT_ORTHOGRAPHY = { - "default": "Latn", + "default": "Original", "available": { - "Latn": {"name": "Latin"}, + "Original": {"name": "Original", "converter": "crkLacombeeng.app.orthography.to_original"}, + "Standardized": {"name": "Standardized", "converter": "crkLacombeeng.app.orthography.to_standardized"} }, } diff --git a/src/morphodict/lexicon/management/commands/importjsondict.py b/src/morphodict/lexicon/management/commands/importjsondict.py index 8a28474f2..bd7816446 100644 --- a/src/morphodict/lexicon/management/commands/importjsondict.py +++ b/src/morphodict/lexicon/management/commands/importjsondict.py @@ -350,7 +350,7 @@ def run(self): slug=entry["slug"], rw_domains=rw_domains, rw_indices=rw_indices, - wn_synsets=wn_synsets, + wn_synsets_string=wn_synsets, is_lemma=True, linguist_info=entry.get("linguistInfo", {}), import_hash=freshness_check.importjson_hash_for_slug(entry["slug"]), diff --git a/src/morphodict/lexicon/models.py b/src/morphodict/lexicon/models.py index 4b2ee3d19..2121aa0eb 100644 --- a/src/morphodict/lexicon/models.py +++ b/src/morphodict/lexicon/models.py @@ -132,7 +132,7 @@ class Wordform(models.Model): """ ) - wn_synsets = models.CharField( + wn_synsets_string = models.CharField( max_length=2048, blank=True, null=True,