Skip to content

Commit

Permalink
feat(pat structure): define translatable columns and translate with `…
Browse files Browse the repository at this point in the history
…plone` domain.
  • Loading branch information
petschki committed Nov 29, 2022
1 parent 9a8858d commit 117e480
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pat/structure/js/views/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export default BaseView.extend({
"end",
"last_comment_date",
];

self.translatableColumns = [
"review_state",
];
},

events: {
Expand Down
4 changes: 4 additions & 0 deletions src/pat/structure/js/views/tablerow.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import $ from "jquery";
import _ from "underscore";
import _t from "../../../../core/i18n-wrapper";
import { translate_plone as _tp } from "../../../../core/i18n-wrapper";
import utils from "../../../../core/utils";
import Backbone from "backbone";

Expand Down Expand Up @@ -109,6 +110,9 @@ export default Backbone.View.extend({
}
return date.toLocaleString(this.app.language, this.app.dateFormat);
}
if (this.table.translatableColumns.includes(column)) {
return _tp(value);
}
return value;
},

Expand Down

0 comments on commit 117e480

Please sign in to comment.