Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kcleong/cbf25ad2cd42e6f5bc0a to your computer and use it in GitHub Desktop.
Save kcleong/cbf25ad2cd42e6f5bc0a to your computer and use it in GitHub Desktop.
<div class='row' id='babel-edit'
xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en"
lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="plone.app.multilingual"
tal:define="pamutils context/@@babel_utils;">
<script src="++resource++plone.app.multilingual.javascript/babel_helper.js"></script>
<input type="hidden" id="url_translate" value="" tal:attributes="value context/absolute_url"/>
<input type="hidden" id="gtanslate_service" value="" tal:attributes="value view/gtenabled"/>
<div class='col-md-6'>
<h1 i18n:translate="heading_available_translations">Available translations for this content</h1>
<div id="trans-selector"
tal:define="languages pamutils/translated_languages;
max_nr_of_buttons view/max_nr_of_buttons">
<div class="btn-group"
tal:define="use_dropdown python:max_nr_of_buttons and max_nr_of_buttons < len(languages);
csrf_token string:?_authenticator=${context/@@authenticator/token};">
<select name="language_selector" tal:condition="use_dropdown">
<option tal:repeat="lang languages"
tal:attributes="value string:${lang/obj/absolute_url}/babel_view${csrf_token};
selected python:lang['isDefault'] and 'selected' or '';
id string:selection-${lang/code}"
tal:content="lang/info/native|lang/info/name">Language</option>
</select>
<tal:block repeat="lang languages" tal:condition="not:use_dropdown">
<button class="btn"
tal:attributes="data-url string:${lang/obj/absolute_url}/babel_view${csrf_token};
class python:lang['isDefault'] and 'btn active' or 'btn';
name string:button-${lang/info/name}"
tal:content="lang/info/native|lang/info/name">Language</button>
</tal:block>
</div>
</div>
<div id="frame-content">
The available translations for this content should be here
</div>
</div>
<div class='col-md-6'>
<div id="header-translation">
<h1 i18n:translate="translation_to">Translation to <span i18n:name="language" tal:content="pamutils/current_language_name" tal:omit-tag="">es</span></h1>
</div>
<div id="form-target">
<tal:block content="structure view/babel_content">Content edit</tal:block>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment