floseries
(Fritz Loseries)
October 15, 2021, 4:18pm
1
Hi,
I cannot find a description for language support for the mockup (and other javascript deployments) in Plone.
Any hint ?
erral
(Mikel Larreategi)
October 15, 2021, 6:08pm
2
This one is hard
You need to i18nize your JS code using _t('XXX'), like here:
define(["underscore", "translate"], function (_, _t) {
"use strict";
var menuOptions = {
"openItem": {
url: "#",
title: _t("Open"),
category: "button",
iconCSS: "glyphicon glyphicon-eye-open",
css: "",
modal: false,
},
"editItem": {
url: "#",
title: _t("Edit"),
category: "button",
iconCSS: "glyphicon glyphicon-pencil",
You need to i18nize your XML templates using also _t('XXX') like here:
<div class="fc-breadcrumbs-container">
<div class="fc-breadcrumbs" colspan="<%- activeColumns.length + 3 %>">
<a href="#" title="<%- _t('Root') %>" aria-label="<%- _t('Root') %>" data-path="/">
<span class="glyphicon glyphicon-home" aria-hidden="true"></span> /
</a>
<% _.each(pathParts, function(part, idx, list){
if(part){
if(idx > 0){ %>
/
<% } %>
<a href="#" class="crumb" data-path="<%- part %>"><%- part %></a>
<% }
}); %>
Then all those strings are extracted and they go to the widgets.pot file in plone.app.locales:
At last, to translate those strings you need to edit the widgets.po file of your language of choice.
floseries
(Fritz Loseries)
October 16, 2021, 2:26pm
3
Thanks for advice.
Based on this I've made some research and ask me now if following link with translation explanation is more advisable and easier to use as long as there is no language update:
Plone Mockup is an ongoing effort to modernize Plone's javascript story. Check out examples and documentation at http://plone.github.io/mockup/
The Goals of Mockup
-------------------
1. Standardize configuration of patterns implemented in js
to use HTML data attributes, so they can be developed
without running a backend server.
2. Use modern AMD approach to declaring dependencies on other js libs.
3. Full unit testing of js
Install & Run Tests
-------------------
Install Node version 0.10 or greater
`Install using package manager, e.g. apt or yum
<https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager>`_
`Install without using package manager
<https://github.com/joyent/node/wiki/Installation>`_
This file has been truncated. show original
Regards, Fritz
erral
(Mikel Larreategi)
October 16, 2021, 5:50pm
4
In that link you can find the explanation on how to test the changes you make in the widgets.po file, because those translations are cached in localStorage.