AmCharts v4 AmMap change language - amcharts

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.

Related

AEM How to prevent localization happening otb?

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.

Organizing i18n source file for data binding

I have a SAPUI5 SplitApp application written in English. There is a need to add translation into another language.
I have already made changes to all my detail views using this documentation and I have used the first approach (jQuery.sap.resources). All translations are in WebContent>i18n>i18n.properties file and in another .properties file for another language. And it works.
The problematic part is my main menu that is situated on the master page. To build my main menu I use data binding approach. Here are the elements of the menu and how I bind them: JSBIN.
I still want to use data binding for the master page.
What is the best way to create/organize file with menu elements and file with translation of those elements?
I don't quite get your question.
You want to use Databinding for your controls and for your i18n - that's not a problem, just use two models and give one of them a name.
var oModel = [The model with the data]
var oModeli18n = [The i18n model]
sap.ui.getCore().setModel(oModel);
sap.ui.getCore().setModel(oModeli18n, "i18n");
Now you can bind your normal data using just the paths, e.g. in an XML-View:
<Text text="{title}" />
You can bind to the i18n model by just prefixing the path with the model name you set before:
<Text text="{i18n>SOME_TEXT}" />
You can use this approach with any type of model and choose any name you want to.
If I did not answer your question, please explain your problem in more detail.
Update:
I used your code to make a working simple example of the basic binding:
http://jsbin.com/wafecaqezu/1/edit?html,js,output
You just have to add the bundle...

Multi-language store- Changing custom menu's language dynamically

I am doing Multi-language store in magento. i have some custom menu in header section like how to order, Help etc. .
now currently these menu i have given direct link like
<li>Help</li>
<li>how to order</li>
i am not sure how multi-language feature will work with this menu.. How can i write these top menu as if It will change with language change.
any suggestions will be helpful for me.
thanks
Any text that is hard-coded into your template needs to be wrapped in the translation helper.
echo $this->__('Help');
But make sure the block it applies to has a helper declared, otherwise you'll need to load the generic helper.
Mage::helper('core')->__('Help')
Then, you can edit the relevant translation CSV file. By putting "Help" in the first column, and the translation in the second column.
Although, you'll be able to use translate in-line once you are using the above PHP.

JasperReports - Conditional style per locale?

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.

text direction in CK Editor

How can I set text direction [rtl] on load editor?
According to the docs, this should do it:
CKEDITOR.config.contentsLangDirection in the CKSource manual
Example taken from there:
config.contentsLangDirection = 'rtl';
Another way to do it is directly from your view file, the benefit of using replace() method is that you can use different direction and style for each of your view.
CKEDITOR.replace( 'article_area', {
contentsLangDirection: 'rtl'
} );
By using replace() you can also do other filtering stuff like allowing/disallowing tags and removing buttons from the editor. for a detailed description visit:
http://ckeditor.com/ckeditor_4.1rc/samples/datafiltering.html
If you use CKEditor version 5, the config block is like:
language: {
ui: 'en',
content: 'ar'
}
Where in this example, the editor itself will remain in english (both headings and orientation) and the content will be edited in arabic (therefore right to left).
I chose this example to illustrate that it's possible to use different languages for these two purposes (say if you build a CMS with the text editor and admins want to add arabic or hebrew translations for different site content but interact with the editor itself in english). But you could also set ui: 'ar' in order to mirror the editor itself as well (note that to do this I think you have to bundle in the languages in one of several ways, see the links below for reference).
The support for bidirectional text seems to be good (aka type something in Arabic and then type in english and it automatically switches to left-to-right only while you type in english).
References:
https://ckeditor.com/blog/CKEditor-5-v12.4.0-with-image-resizing-to-do-lists-RTL-language-support-and-more/
and the linked
https://ckeditor.com/docs/ckeditor5/latest/features/ui-language.html#righttoleft-rtl-languages-support
CKEDITOR.replace('editor1', {
language: 'es',
removeButtons: 'PasteFromWord'
});
just change the ContentsLangDirection="Rtl" inside the CkEditor like below
<CKEditor:CKEditorControl ID="CKEdMainPageDescriptionWebsiteMobileappAr" BasePath="ckeditor/" runat="server" Width="100%" Toolbar="Basic" ContentsLangDirection="Rtl"
ToolbarBasic="|Bold|Italic|Underline|Strike|-|NumberedList|BulletedList|Outdent|Indent|-|JustifyLeft|JustifyCenter|JustifyRight|JustifyBlock|
|Styles|-|Format|-|Font|-|FontSize|
/
|Link|Unlink|-|TextColor|-|Undo|Redo|Cut|Copy|Paste|PasteText|PasteFromWord|"> </CKEditor:CKEditorControl>
As of version 5, the direction can be set by changing language settings. You can see more details here.

Resources