JasperReports - Conditional style per locale? - internationalization

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.

Related

Telerik Reporting Styles

I have just started messing with Telerik Reporting in an MVC C# application.
Since I need to create a dozen of reports, I was asked to create an external style to be aplied to all of them.
I cannot understand how it works, how to set the rules...
Eg I can create a style to affect all HtmlTextBoxes BUT I am trying to create a rule to have all the HtmlTextBoxes contained in the Group Header having (lets say) blue Background, Bold Segoi Font and I cannot.
Any help appreciated
Styles created in a Telerik Report can be exported and then used in other reports.
You can store one or more Styles in an exported file.
The exported information is stored in an XML file.
So you can create your style rules using the Style context menu Right-clicking on the report object.
Style exporting and reusing style sheets
Use various Style Selectors to define how a style will be applied globally to items in a report. Each Style Rule that you create (either in code or using the StyleRule Collection Editor) must be created as one of the basic four selector.
Learn more about style selector.. For me the best one is the "StyleSelector" that behave like a Css Class.
Nb:
You can manage and bind your extenal StyleSheet in code behind.
Or in your calling application.
this.StyleSheet.Clear();
this.ExternalStyleSheets.Add(
new Telerik.Reporting.Drawing.ExternalStyleSheet("baseThemeRpt.xml"));
It can be done using the Descendant Type

Internationalization for richfaces custom skin

We are using some custom skin for rich faces and below are 2 properties file for packed and packedCompressed
mySkin-packed-resource-mappings.properties
mySkin-packedcompressed-resource-mappings.properties
This property file has a mapping for home_icon e.g.
images\:home_icon.png = org.richfaces.staticResource/4.3.5.Final/Packedorg.richfaces.images/home_icon.png
My questions are:
How these does this mapping is used for richfaces custom skin? as I
could not find any reference in my code for this key
images:home_icon.png
Does richfaces support internationalization for custom skin
resources like above one?
If answer to above question is yes and assuming that this mapping is
for default English language, how can I add a mapping for another
language like Arabic?
Please correct me if I have understood it wrong?
Skin has nothing with internationalization. Skin properties setup colors, fonts, font sizes for different parts of UI. Internationalization files used for text setup and not related to skins.
About your questions:
1) regular RichFaces skin property file does not contain icon related properties, like images\:home_icon.png;
2) internationalization is not related to custom skin;
3) you can add internalization support for any language you want, but it is not related to skin properties.
On other side, it is totally valid to use background-image: "#{a4jSkin.imageUrl('inputBackgroundImage.png')}"; in ecss files, but it has nothing with internationalization.

Using variables in custom joomla module for tooltips

I'm new to joomla development, but I can't seem to figure out how to dynamically fetch descriptions to be displayed as tool tips for the form data of a module backend. I'm looking at an example module from joomlart and their code for a single field element in their xml file looks like this.
<field
name="mainWidth"
type="text"
default="auto"
size="5"
label="MAIN_WIDTH"
description="MAIN_WIDTH_DESC" />
MAIN_WIDTH and MAIN_WIDTH_DESC are obviously variables that are somehow being accessed and rendered later when the module is run in the backend but I can't find where the values to these variables are stored or how to replicate this behavior. Any help would be appreciated.
Label is the label that prints to screen, and description is rendered as the tooltip.
You can just replace these variable names with the actual text and it will work when the form is rendered.
However, in your example, I believe they are using language files to get the text to display.
Whilst you can set a language file within your module for that module's use, naming convention suggests to me that these are being pulled from somewhere like the template's language file.
( Such a file is likely to be found either under /language or /administrator/language or /templates/yourtemplate/language )
The benefit of such files is to allow for translations of the site to exist without having to write a new module / template each time.
Ultimately, if you don't want various language versions of your site, and you only intend to use the module on one site and not sell it as an extension, then there is no strong need to create a language file for your own bespoke modules (though best practise would probably be to do so).

Joomla mulitple layouts in a single template?

Respected Specialists,
Is it possilble to create mulitple layouts inside a single joomla template ?. So that for each menu we can choose different layouts from the same template ?
Yours faithfully
Murulimadhav
Yes you can. You can code it by hand yourself if you want to, or look at using a library like Gantry to do the job.
Gantry is reasonably easy - as it gives you some default templates to start with. You can then customize them, and nominate which positions within the template actually display.
The easiest way would be to make multiple copies of your template, modify them and assign them to the various menus. To duplicate a template follow the steps described in the following:
Joomla2.5
Joomla3.2

Dojo internationalization via markup outside of widgets

Dojo custom widgets can be internationalized via the _templated mixin following the steps outlined here and here. Then placeholders within the widget template like this: ${i18n.username} are automatically replaced with the appropriate language translation.
What is the simplest way to do similar nls language substitution outside of a widget? Ideally, I would like to add an attribute to a tag to have all the placeholders within substituted, including nested tags. Is there some type of container widget that already does this?
Or does Dojo development assume everything will be in a (custom) widget? I need to localize already existing code which doesn't use widgets.
The best solutions I have found so far are:
Using dojox.mobile.i18n, which is a "a thin wrapper around dojo.i18n, and has ability to replace strings, such as CDATA or attribute values, in dojo markup." However I'm afraid this is limited to a certain subset of mobile tags/widgets.
Disabling automatic parsing and manually searching/replacing the appropriate text before explicitly calling the parser in dojo.addOnLoad().
I assumed that the notation in the external html is ${i18n.username}.This will find any node that has class="i18nReplace" and replace the innerHTML of the node. I didn't test any of this, but I hope you can use it as a starting point.
dojo.require("dojo.i18n");
dojo.require("dojo.query");
dojo.requireLocalization("myI18n", "myI18N"); // This will need to be modified to get your i18n files
dojo.addOnLoad(function() {
var i18n = dojo.i18n.getLocalization("myI18n", "myI18N");
dojo.query(".i18nReplace").forEach(function(node, index, arr){
node.innerHTML = dojo.replace(node.innerHTML, { i18n: i18n } );
// blindly doing this, does not support nested tags.
// you could add conditional logic to check for children
// and if they exist separately process them, otherwise
// replace the html.
});
});

Resources