Change display text of Actions for Arabic Locale in iBM Content - ibm-content-navigator

I have a requirement where I need to change the text of Actions like Add Document, Refresh, New Folder when in arabic. Can anyone point me towards any sample code that can help me accomplish this. Thanks in advance.

This is a quick and dirty way.
An optional and probably a more maintainable way is to place all your translations in a property file, then load the text based on your locale.
public String changeMyText(Locale locale, String text) {
if ("ar".equalsIgnoreCase(locale.getLanguage())) {
if ("Actions".equalsIgnoreCase(text)) {
return "arabic translation of actions";
}
}
return "no_valid_translation";
}

Related

Why does input field get only the viewed text?

I know it might sounds stupid but I have an input field, in my C# script I get it using this
public Text emailInput;
public string email = emailInput.text;
but let's say I got my email ' calin.onaca#icloud.com '.
If after I write the email and it only display ' calin.onaca#icloud.co' or 'alin.calin#icloud.com' because of font size it might not display all the text which is fine, but the code receives only the displayed text.
Is it normal? How can I get all text not only the displayed one.
Thank you in advance.
Assuming this is a standard Unity InputField, you'll want to use that type instead.
public InputField emailInput;
var email = emailInput.text;
If you try to grab just the inner Text child of the InputField, you'll see inconsistent results.

Validate/Restrict zalgo texts in Javascript

Can I validate a user from entering zalgo texts to a form or any other place which prompts a data save, as explained in [Zalgo Texts]: How does Zalgo text work?
As per your need you can use the following to validate a string as such.
Furthermore you can use strip-combining-marks if you want to remove Unicode combining marks from strings.
function validateZalgo(s) {
return /[^\u+0300-\u+036F]/.test(s);
}
var isValidated = validateZalgo('asd̨͈̺̱̤͚̤͚̤͚͈̆̆̆̆̆̆̆̆̆̆');
alert(isValidated);

Kentico Phone Format not consistent

I'm adding a US phone number to a form in Kentico 9 but the format is not consistent. When I create my form in the Form Builder it looks like this:
Well Formatted US phone format
However when I view the form it Kentico splits up the phone number into it's component parts and places them all on one line. I'm not finding a place to fix this. Seems like a silly way to work...
Bad Phone image
I've tried creating Custom Layouts but it doesn't appear to allow you to control the format there.
I am not sure if I understand you right - you have a form with field (Data type: text) which is using U.S. phone number form control. You can specify proper behavior in ~/CMSFormControls/Inputs/USphone.ascx (default path where are files for this form control). You can specify css classes in USphone.ascx and general behavior in USphone.ascx.cs file. Please note this property:
public override object Value
{
get
{
if (IsEmpty())
{
return String.Empty;
}
return String.Format("({0}) {1}-{2}", txt1st.Text, txt2nd.Text, txt3rd.Text);
}
.
.
.
}
In return there is specified way you are formatting text - this might help you to achieve your desired behavior.

silverstripe backend linebreaks in content do not show up in frontend

I have a textareaField in Silverstripe Backend in Edit Page View... The text to insert contains linebreaks. If I save the Page the text shows correctly with linebreaks in the textareaField. The linebreaks are for sure saved correctly to the database. But how do I display the text correctly in the frontend? It´s always outputted without linebreaks in a single line.
I tried already $Text.RAW, $Text.XML,... nothing works.
Thanks for the help,
Kind regards,
Florian
Assuming that you are using 3.0 this is a bug. You can see it here http://open.silverstripe.org/ticket/7596
A work around is to write your own function calling nl2br on your text field.
Here is an example:
public function NiceDescription () {
return (nl2br (Convert::raw2xml ($this->Description), true));
}
You can replace "Description" with the name of your text property.
Then in your template file if you need to display the description field you will call the function:
$NiceDescription
to visually render the newlines in html, you need to convert them to <BR> tags.
see http://php.net/manual/de/function.nl2br.php

HTML Tags in GWT internationalization

I'm using the internationalization of GWT to manage the different languages of my application. I have a text where some words are in bold. Therefore I did the same thing as described here.
#DefaultMessage("Welcome back, {startBold,<b>}{0}{endBold,</b>}")
String testMessage(String name);
However, when I run the application, I get "Welcome back, < b>Peter< /b>" (the HTML is written out and not interpreted. I intentionally put a space between < b so that this text editor does not interpret the html tag).
Does anyone know how to solve this issue? Many thanks in advance!
P.S.
Code fragment which gets the language string:
Label label = new Label();
label.addStyleName("intro-Text");
label.setText(new HTML(trans.testMessage(name)).getHTML());
Instead of using a Label use the HTML widget.
HTML text = new HTML();
text.addStyleName("intro-Text");
text.setHTML(trans.testMessage(name));
Hope that helps.