Opened on 03/12/2015 at 06:13:20 PM

Closed on 03/12/2015 at 09:17:11 PM

Last modified on 05/14/2015 at 10:32:10 AM

#2133 closed change (fixed)

[cms] Allow to specify default translation inline in pages rather than in a separate file

Reported by: trev Assignee: trev
Priority: P4 Milestone:
Module: Sitescripts Keywords:
Cc: Blocked By:
Blocking: #2035, #2111 Platform: Unknown
Ready: yes Confidential: no
Tester: Verified working: yes
Review URL(s):

Description (last modified by trev)


Currently, we require all translations to be inside .json files. While this makes uploading translations to Crowdin easier, it also means that editing page files is very complicated - one has to constantly match string references to the strings in the locale file.

What to change

Allow specifying the default translation (typically English) inline in the page. The format should be as follows:


<p>{{click_text Click <a href="data:">here</a>.}}

<p>{{click_text[Optional comment for translators] Click <a href="data:">here</a>.}}


<p>{{click_text Click [here](data:).}}

<p>{{click_text[Optional comment for translators] Click [here](data:).}}

Jinja2 template:

<p>{{'Click <a href="data:">here</a>.'|translate("click_text")}}

<p>{{'Click <a href="data:">here</a>.'|translate("click_text", comment="Optional comment for translators")}}

In some cases, Jinja2 templates will still need to read data from a locale file. No default will be specified then, meaning that a .json file is still required for English here:

<p>{{get_string("toc_title", "interface")}}</p>

Note that there is a conceptual change here: currently, the CMS looks at the locale files whenever it needs to determine which locales are available for a page. Now it has to assume that each page is automatically available in the default locale, regardless of whether a corresponding locale file exists.

Attachments (0)

Change History (5)

comment:1 Changed on 03/12/2015 at 07:24:03 PM by trev

  • Description modified (diff)

comment:2 Changed on 03/12/2015 at 07:35:08 PM by trev

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:3 Changed on 03/12/2015 at 09:17:11 PM by trev

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:4 Changed on 03/13/2015 at 02:17:54 PM by trev

  • Blocking 2105 removed

comment:5 Changed on 05/14/2015 at 10:32:10 AM by Ross

  • Verified working set

Implemented and working.

Tested by:
Creating a CMS page and creating various translatable links (HTML, Markdown, Jinja). Also running the website converter script as per the read me and checking the output.

Tested with:
www / r18024
sitescripts / r501 / r68
website-converter / master / 105208883c4336a3788820fe9ab379cf639f8387

Add Comment

Modify Ticket

Change Properties
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from trev.
Note: See TracTickets for help on using tickets.