I have a scenario wherein i18n becomes overhead to content authors. The authors want dialog labels to be in English only for all locales. But certain headings/labels on dialog gets localized as they are available in otb dictionaries. Example label 'Advanced' from page properties dialog gets translated for non-english sites.
Is there a way I can prevent internalization happening?
If you refer to AEM's documentation for i18n, you can see its driven by the locale/language set in slingRequest. you can override this by explicitly fixing the i18n but if you do that none of your translations will work -
Locale pageLang = new Locale("en");
ResourceBundle resourceBundle = slingRequest.getResourceBundle(pageLang);
I18n i18n = new I18n(resourceBundle);
An other alternative (a little extra effort) in you need to do this only for dialog boxes is -
Create your own dictionary for translations, refer here
Use unique name-spacing for your keys eg - myapp.mycomponent_abc.label
Use above keys in your component dialog to ensure that your version of translation is picked. If for all languages you want english only dialogs, all your have to do is duplicate your english dictionary and change the language key in it to relevant language while keeping translations still in english.
Related
I would like to change the language of a ammap (V4).
Therefore I followed the example which is provided here (but it is for V3): http://jsfiddle.net/tDqs2/25/
Here first the language get loaded via a script tag.
<script src="http://cdn.amcharts.com/lib/3/lang-maps/de.js">
Now if I follow the instructions I don't see any map.
Here is my codepen:
https://codepen.io/ms92o/pen/mjMpZy
that line does not work:
chart.language = 'de';
Looking at the API for language I do find a language property:
https://www.amcharts.com/docs/v4/reference/mapchart/
But how do I set the language?
The language constructor does not need any parameters
let language = new am4core.Language();
// How to change that language to 'DE'.
A German translation was added earlier this month.
You can find other currently available translations here: https://github.com/amcharts/amcharts4-lang/tree/master/src
To change the language to say, German, we have to include the translation first as it isn't one of the bundled locales:
<script src="https://www.amcharts.com/lib/4/lang/de_DE.js"></script>
Then to change the language, each chart has a language property, we update its locale property, i.e. chart.language.locale, to the translation of choice:
chart.language.locale = am4lang_de_DE;
(Please note, updating the chart's language dynamically is not yet supported in v4. If it's something you're interested in, please subscribe to this GitHub issue to keep posted.)
Here's a simple chart demo in English:
https://codepen.io/team/amcharts/pen/ZRaWJQ
Same demo in German via above code: https://codepen.io/team/amcharts/pen/4d968a6f292fca2dc59d5e75b0389e0e/
If you would like to roll your own translation or contribute to an existing one, check out the Creating Translations guide.
I am understanding this better but still not there yet.
I have a notes document with a rich text field. I want to edit it in Xpages, so that the user can enter text for an email that an agent will generate. The idea is that the user should be able to enter styled text, hopefully including pasted graphics, and this is saved to the rich text field in such a way that a later agent can copy that field to the body of an email.
On the form I have checked the field "Store contents as HTML and MIME.
In the Xpage I have bound the CKEditor directly to the field (can bind it to a scope variable if necessary).
The code in my agent is as follows:
Set rtItmFrm = emlDoc.getFirstItem("Body")
Set rtItmTo = New NotesRichTextItem(mail,"Body")
Set rtItmTo = rtItmFrm.Copyitemtodocument(mail,"Body")
Any further suggestions on reading up on MIME/CKEditor etc would also be much appreciated.
Bryan
=========================================================================
I just discovered how to modify the CKEditor in Xpages (the Rich Text Control). I have the full menu and one or two more things turned out. However, I am really puzzled by how it treats HTML. I would like to put a template for a nice HTML email (like a newsletter). Anything even a little complicated it munges and the output is messed up.
I read enough online to understand that it is not supposed to be a HTML editor, but I am really having trouble getting the results I want. I would love to put some basic skeleton HTML in there, but everything but the simplest code doesn't work.
Is there anyway to import HTML and it not get messed up using this editor?
as Per and Stephan said, Have a look at ACF filtering that is 'server side' (This is not related to CKEditor itself, but it is related to XPages).
If you have a look at the inputRichText control you will see 2 properties.
htmlFilter
htmlFilterIn
These properties determine how to filter Html on the way in to your data, and also on the way out.
This can be used to strip styling out, and also to prevent dangerous tags like some bad code here etc.
By Default the htmlFilter is set ACF (Active Content Filtering) if you look at the default rules, you will see it strips things like 'margin' out.
see /properties/acf-config.xml-sample
There is a filter called 'identity' which means don't filter anything, however beware if you use this you are not protected from and maliciously entered html.
You should look into defining your own set of rules for your ACF filter, this way you can choose which elements to remove. There is a section in Mastering XPages book about this.
If you still have any trouble, then there are some settings in CKEditor config which also control ACF (totally separate to XPages server side)
I don't think CKE changes the HTML, it is the writing back to a RT field.
Try and bind your RichText Editor to a scoped variable instead of a RichText field. This way you have access to the raw HTML and can use that to generate a MIME email. You might want to have a look at Mustache for mail merge.
Use this article series as starter how to prepare CK editor to make this possible.
And as Per mentioned: check the filtering.
In the back-end when managing the attribute from the attribute set i show him what text to display for the languages i have (Romanian And russian are currently active and important)
http://prntscr.com/32rhrm
However in the frontend as in Romanian Language so in Russian language it will layout the text that i input for the Admin in the attribute set
http://prntscr.com/32rhxz
how do i fix it?! how do i make it show the corresponding text for the needed language?
Thank you !!!
I have am trying to dig into twitter bootstrap and rails3 sites that actually look and function well (new to it all). I have this feature I want where I have a twitter bootstrap navigation (specified in what I guess is the default application layout) that calls a _navigation.erb.html etc. This works great, but on that navigation i want a "Se Habla Espanol" or what not, where when the user clicks there, the navigation text all changes to spanish. i thought easiest would be have another _navigationespanol.erb.html or something that changes the navigation words all around and also when click (toggling into spanish mode) it sets all the text in the pages to spanish by anytime there is a text render or whatever a variable flag was set and is interrogated on page index render show or what have you and it renders spanish or english words...
So ideally click on see it all in spanish, it loads a new layout (my main question) that has the spanish navigation and messages and other twitter bootstrap stuff and it also sets a global var i can look at in other renders to see if im rendering english or spanish.
More than swapping layouts, it seems that you need to implement Internationalization (I18n). In such case you'll have to create an directory config/locales that holds a .yaml file for each of the language you're trying to have translation for, for instance:
# on a file called en.yml
en:
hello: "Hello world"
For a complete guide on how to go about it: Rails Internationalization (I18n) API
Is there a way to use a different styles, or redefine a style, based on a report parameter locale? I need to modify font sizes for certain languages.
I have implemented this in the past using external style templates. There is a sample on jasperforge that illustrates how to do this.
Once you've moved your styles to external templates, you can create locale specific templates. The templating mechanism allows you to inherit from and override specific styles, so the locale specific versions don't get overly bloated. The example I linked above includes inheriting from and overriding base styles.
In your reports, you can then load the appropriate template at render time.
One easy way to do this is:
provide the path to the template that you want to use as a parameter
to the report
include a template tag in the jrxml file that references the
parameter:
<template><![CDATA[$P{TEMPLATE_PATH}]]></template>
Then, in the code that renders the report, just set the TEMPLATE_PATH parameter appropriately for the report locale.
Again, the linked documentation mentions how to do this.