'Tinymce add additional words to existing translation
We use tinymce in a rails application using two gems:
Using tinymce-rails 5.8.2 Using tinymce-rails-langs 5.20200505
We would like to add some additional translations of individual words and change a couple without disturbing the rest. Is that possible? In config/tinymce.yml we have 'setup: tinyMceSetup' so I added a line at the bottom of app/views/javascripts/tinymce_setup.js.erb where tinyMceSetup is defined: "tinymce.util.I18n.add('es',{"Line height": "Altura de la L\u00ednea"})" , thinking that that would add just the desired translation but it adds it and wipes out everything else.
Checking the documentation for tinymce I can't find a way to access the translation hash and just change a single key:value pair. Maybe someone knows a way to do it or has another method that will work for us? Thank you
Solution 1:[1]
You've got the right idea to be able to add translations programmatically. The problem however is that if translations are added before the ScriptsLoaded event is fired then it'll appear as if the translations are already loaded and won't attempt to load them. As such, the setup function in combination with the ScriptsLoaded event can be used like so to add additional custom translations programatically:
setup: function(editor) {
editor.on('ScriptsLoaded', function() {
tinymce.addI18n('es',{"Line height": "Altura de la L\u00ednea"});
});
}
Note: tinymce.addI18n is just an alias for tinymce.util.I18n.add.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
