Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
An automatic string translate for Magento 2 KO components
define(['ko', 'mage/translate'], function (ko) {
* @description runs every string that is bound through $.mage.__ (translation)¬
* @param val¬
* @returns {string
ko.bindingHandlers.text.preprocess = function (val) {¬
return $.mage.__(val);¬
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.