{"result":{"depiction_url":null,"edges":{"refers":{"objects":[{"created":"2026-11-01T14:34:59Z","object_id":{"id":1381,"is_a":["text","documentation","reference","template_tag"],"name":"doc_template_tag_tag_trans_ext","title":"trans_ext","uri":"https:\/\/zotonic.com\/id\/1381"},"seq":1000000},{"created":"2026-11-01T14:34:59Z","object_id":{"id":3129,"is_a":["text","documentation","reference","template_tag"],"name":"doc_template_tag_tag_with_msgctxt","title":"with_msgctxt","uri":"https:\/\/zotonic.com\/id\/3129"},"seq":1000000}],"predicate":{"id":2409,"is_a":["meta","predicate"],"name":"refers","title":{"_type":"trans","tr":{"en":"Refers"}},"uri":"https:\/\/zotonic.com\/id\/refers"}},"subject":{"objects":[{"created":"2026-11-01T14:34:59Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-11-01T14:34:59Z","object_id":{"id":2563,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_frontend_developer","title":"Frontend developer","uri":"https:\/\/zotonic.com\/id\/2563"},"seq":2},{"created":"2026-11-01T14:34:59Z","object_id":{"id":2588,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_localization_and_translation","title":"Localization and translation","uri":"https:\/\/zotonic.com\/id\/2588"},"seq":3},{"created":"2026-11-01T14:34:59Z","object_id":{"id":2620,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_template","title":"Template","uri":"https:\/\/zotonic.com\/id\/2620"},"seq":4},{"created":"2026-11-01T14:34:59Z","object_id":{"id":2669,"is_a":["categorization","keyword","keyword_data_type"],"name":"zotonic_topic_translated_text","title":"Translated text","uri":"https:\/\/zotonic.com\/id\/2669"},"seq":5}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":3130,"is_a":["text","documentation","reference","template_tag"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/3130"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_template_tag_tag_msgctxt","page_url":{"en":"https:\/\/zotonic.com\/docs\/3130\/msgctxt","x-default":"https:\/\/zotonic.com\/docs\/3130\/msgctxt"},"preview_url":null,"resource":{"version":15,"pivot_location_lat":null,"title":"msgctxt","is_authoritative":true,"body":"<p>Set a template&#39;s default gettext message context:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-django\">{% msgctxt &quot;shop: checkout&quot; %}\n&lt;h2&gt;{_ Order _}&lt;\/h2&gt;\n{% button text=_&quot;Continue&quot; %}\n<\/code><\/pre>\n<p>Declare it once, before output or blocks. An <code>extends<\/code> or <code>overrules<\/code> tag may\nprecede it. The context must be a literal string and is extracted as <code>msgctxt<\/code>\nin the POT file. Use stable semantic labels, rather than template filenames.<\/p>\n<p>The default applies to <code>{_ ... _}<\/code>, <code>_&quot;...&quot;<\/code>, and <code>{% trans ... %}<\/code> messages.\nOverride it with <a href=\"\/id\/doc_template_tag_tag_with_msgctxt\" class=\"doc-reference doc-reference-tag\"><code>tag#with_msgctxt<\/code><\/a> or an explicit <code>msgctxt<\/code> argument on\n<a href=\"\/id\/doc_template_tag_tag_trans_ext\" class=\"doc-reference doc-reference-tag\"><code>tag#trans_ext<\/code><\/a>. Included and inherited templates use their own declarations.<\/p>\n<p>For each language, lookup tries the contextual translation and then the\ncontextless translation. It then tries fallback languages, finally using the\nEnglish source. An empty context string is distinct from no message context.<\/p>\n<p>Adding a context creates new catalog identities. Existing contextless\ntranslations remain usable through fallback while contextual entries are translated.<\/p>\n<p>A module can supply the default for all its templates using an attribute on\nits module Erlang file, alongside <code>mod_title<\/code> and <code>mod_description<\/code>:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">-mod_msgctxt(&quot;shop: checkout&quot;).\n<\/code><\/pre>\n<p>The selected template file&#39;s owning module supplies this default, including\nwhen templates override another module&#39;s templates. Includes and inherited\ntemplates each use their own module&#39;s default. A template&#39;s <code>msgctxt<\/code> declaration\noverrides the module default; scopes and explicit <code>trans<\/code> arguments override it\nin turn. An explicitly empty context remains an override.<\/p>\n<p>POT extraction uses the same default. The attribute applies to templates;\nErlang translation calls and macros continue to take their message context\nexplicitly. Modules without the attribute retain their existing behavior.<\/p>","slug":"msgctxt","is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"719890ca8bfcde5ae697ce370f4d54bf03385f004435542fb310587f9407176b","is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"category_id":{"id":324,"is_a":["meta","category"],"name":"template_tag","title":"Tags","uri":"https:\/\/test.zotonic.com\/id\/324"},"doc_source_path":"doc\/template-tags\/msgctxt.md","publication_start":"2026-11-01T14:34:59Z","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/doc\/template-tags\/msgctxt.md","pivot_location_lng":null,"doc_source_kind":"template_tag","name":"doc_template_tag_tag_msgctxt","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2026-11-01T14:34:59Z","uri":null,"doc_status":"current","is_dependent":false,"publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"e1f1392bf9230e1d94beb144981b9788b1b53e00\n","creator_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"modified":"2026-11-01T16:58:27Z","title_slug":"msgctxt"},"uri":"https:\/\/zotonic.com\/id\/3130","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/3130"}},"status":"ok"}