how to translate sign under appbar buttom - localization

Hello I want to localize text below standard AddAppBarButton
<Style x:Key="AddAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
<Setter Property="AutomationProperties.AutomationId" Value="AddAppBarButton"/>
<Setter Property="AutomationProperties.Name" Value="Add"/>
<Setter Property="Content" Value=""/>
</Style>
I've tried in Resource filead add something like
ButtonId.AutomationProperties.Name = value
But it doesn not work. I get errors when app starts. How can I trasnlate this property ?

Why not put the translation strings in resource files and let XAML parser do the work?
You need to create a folder in your project matching the locale name and put a resw file inside it, e.g sl-SI\Resources.resw.
Add x:Uid attribute to XAML elements to name them:
<Button x:Uid="AppBarButton" Style="{StaticResource AddAppBarButtonStyle}" />
Now just name the resource strings appropriately so that the XAML parser will find them. The pattern is UidName.PropertyName, e.g. Button.Content. In the case of AppBar buttons the syntax is a little more complex because of attached properties:
AppBarButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name

You could try AutomationProperties.SetName(ButtonId, value);

Related

Using Text Mask component with Ant design Input

I have been testing 'react-text-mask' library and I want to use this component together with ant design Input component using its render attribute. However, it doesn't show formatted text.
<TextMask
mask={[/[12]/, /\d/, /\d/, /\d/, "-", /[01]/, /\d/, "-", /[0-3]/, /\d/]}
placeholderChar="_"
showMask
render={(ref, props) => (
<Input
name="phone"
className="form-control"
placeholder="Hey I am Ant design Input"
required
ref={ref}
{...props}
/>
)}
/>
If I change the tag with It shows formatted text like we expect.
My main intention to show every input component should be displayed like an ant design component.
demo
You can make it using react-input-mask library.

Is there a way to update textarea 2 simultaneously while typing text in text area 1 using JSF ajax features? [duplicate]

I am trying to implement jQuery with PrimeFaces and JSF components, but it's not working properly. When I tried to do the same with HTML tags it;s working properly.
Here is the code with HTML tags which works properly with jQuery:
<input type="checkbox" id="check2"></input>
<h:outputText value="Check the box, if your permanent address is as same as current address."></h:outputText>
<h:message for="checkbox" style="color:red" />
with
$("#check2").change(function() {
if ($("#check2").is(":checked")) {
$("#p2").hide();
} else {
$("#p2").show();
}
});
Here is the code with PrimeFaces/JSF which doesn't work properly with jQuery:
<p:selectManyCheckbox >
<f:selectItem itemLabel="1" value="one" id="rad" ></f:selectItem>
</p:selectManyCheckbox>
with
$("#rad").change(function() {
if ($("#rad:checked").val() == "one") {
$("#p2").hide();
} else {
$("#p2").show();
}
});
You should realize that jQuery works with the HTML DOM tree in the client side. jQuery doesn't work directly on JSF components as you've written in the JSF source code, but jQuery works directly with the HTML DOM tree which is generated by those JSF components. You need to open the page in webbrowser and rightclick and then View Source. You'll see that JSF prepends the ID of the generated HTML input elements with the IDs of all parent NamingContainer components (such as <h:form>, <h:dataTable>, etc) with : as default separator character. So for example
<h:form id="foo">
<p:selectManyCheckbox id="bar" />
...
will end up in generated HTML as
<form id="foo" name="foo">
<input type="checkbox" id="foo:bar" name="foo:bar" />
...
You need to select elements by exactly that ID instead. The : is however a special character in CSS identifiers representing a pseudo selector. To select an element with a : in the ID using CSS selectors in jQuery, you need to either escape it by backslash or to use the [id=...] attribute selector or just use the old getElementById():
var $element1 = $("#foo\\:bar");
// or
var $element2 = $("[id='foo:bar']");
// or
var $element3 = $(document.getElementById("foo:bar"));
If you see an autogenerated j_idXXX part in the ID where XXX represents an incremental number, then you must give the particular component a fixed ID, because the incremental number is dynamic and is subject to changes depending on component's physical position in the tree.
As an alternative, you can also just use a class name:
<x:someInputComponent styleClass="someClassName" />
which ends up in HTML as
<input type="..." class="someClassName" />
so that you can get it as
var $elements = $(".someClassName");
This allows for better abstraction and reusability. Surely those kind of elements are not unique. Only the main layout elements like header, menu, content and footer are really unique, but they are in turn usually not in a NamingContainer already.
As again another alternative, you could just pass the HTML DOM element itself into the function:
<x:someComponent onclick="someFunction(this)" />
function someFunction(element) {
var $element = $(element);
// ...
}
See also:
How can I know the id of a JSF component so I can use in Javascript
How to use JSF generated HTML element ID with colon ":" in CSS selectors?
By default, JSF generates unusable IDs, which are incompatible with the CSS part of web standards
Integrate JavaScript in JSF composite component, the clean way
You also can use the jQuery "Attribute Contains Selector" (here is the url http://api.jquery.com/attribute-contains-selector/)
For example If you have a
<p:spinner id="quantity" value="#{toBuyBean.quantityToAdd}" min="0"/>
and you want to do something on its object you can select it with
jQuery('input[id*="quantity"]')
and if you want to print its value you can do this
alert(jQuery('input[id*="quantity"]').val());
In order to know the real html tag of the element you can always look at the real html element (in this case spinner was translated into input) using firebug or ie developer tools or view source...
Daniel.
If you're using RichFaces you can check rich:jQuery comonent. It allows you to specify server side id for jQuery component. For example, you have component with specified server id, then you can apply any jQuery related stuff to in next way:
<rich:jQuery selector="#<server-side-component-id>" query="find('.some-child').removeProp('style')"/>
For more info, please check doumentation.
Hope it helps.
look this will help you when i select experience=Yes my dialoguebox which id is dlg3 is popup.and if value is No it will not open

How to extend felogin's locallang?

How is it possible to add translations of strings to the felogin plugin? I slowly start to get the convention for templates (directing to the modified templates in the plugin's typoscript configuration) but that does not work with the locallang. The original messages are in English in the xlf format, located in the plugin's folder. I know this can be done in TypoScript but I do not like to have the strings defined so incosistently. (I guess modifying that original file is not the proper way.)
Overriding labels by TypoScript is the way to go. Manually editing the l10n files is a really bad idea - these files are overwritten on updating the translations. If the extension gets an update and new labels are added, you will want to perform the updates.
The change from XML files for translation to the XLIFF format didn't change anything in the best practise you should use for adjusting labels according to your needs. It's just another format with a standardized translation server (Pootle) that (in theory) allows some special features like e.g. plural forms.
Conclusion: Use TypoScript.
For the default language (no config.language set) use:
plugin.tx_felogin_pi1._LOCAL_LANG.default {
key = value
}
For a specific language, e.g. German, use
plugin.tx_felogin_pi1._LOCAL_LANG.de {
key = value
}
The best way is to use the following code:
ext_tables.php, e.g. of your theme extension with
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:felogin/Resources/Private/Language/locallang.xlf'][] = 'EXT:theme/Resources/Private/Language/locallang_felogin.xlf';
and in this file you can use something like
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2015-06-30T21:14:27Z">
<header>
<description>Language labels for felogin</description>
</header>
<body>
<trans-unit id="permalogin">
<source>An diesem Rechner angemeldet bleiben</source>
</trans-unit>
<trans-unit id="ll_forgot_header">
<source>Passwort vergessen?</source>
</trans-unit>
<trans-unit id="ll_welcome_header">
<source>Sie betreten den Händlerbereich</source>
</trans-unit>
<trans-unit id="ll_welcome_message">
<source>Bitte loggen Sie sich ein.</source>
</trans-unit>
</body>
</file>
</xliff>
You can use the BE language module to download preconfigured locallangs for every language you need.
The files are stored in e.g. typo3conf/l10n/de/fe_login.
You can edit these files manually in l10n to get your own strings inside or use an extension like snowbabal to do the editing inside a BE module.

How to simplify assigning the same converter to multiple bindings (windows store app)?

<TextBlock Visibility="{Binding IsTrue1, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<TextBlock Visibility="{Binding IsTrue2, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<TextBlock Visibility="{Binding IsTrue3, Converter={StaticResource BooleanToVisibilityConverter}}"/>
The "Converter" Property is on Binding, not on TextBlock, so I can't use a style on TextBlock.
Each binding is different, so I can't create a single Binding resource.
So, how to avoid setting the same converter 3 times?
EDIT: I'll try to explain a bit more. What I'm looking for is a way to give the binding object a default converter, so that I don't have to set the same converter over and over again when I create many bindings with the same converter.
So if I can write sth like:
<Grid DefaultBindingConverter="{StaticResource BooleanToVisibilityConverter}">
<TextBlock Visibility="{Binding IsTrue1}"/>
<TextBlock Visibility="{Binding IsTrue2}"/>
<TextBlock Visibility="{Binding IsTrue3}"/>
...
Clearly this is not correct, just to illustrate my idea.
Hope this time I explained it clear enough.
Let's touch about two issues in your question.
1. Single Resource
It seems that you are misunderstood about the StaticResource definition in Converter.
The BooleanToVisibility that you've coded, for example, is worked not three-times-copied object. It only declared once and used three times.
Let's take another example, if you code as below
int i;
i=1;
i=2;
i=3;
You declared i once, and used it three times. Likewise, StaticResource that you used are works as similar. You may declare x:Key="BooleanToVisibility" in <UserControl.Resources> or <Application.Resources> tag, that's it.
2. Style usage
If you want to set Style in TextBlock, you may use below approach.
<TextBlock Visibility="{Binding Number1, Converter={StaticResource BooleanToVisibilityConverter}}">
<TextBlock.Style>
<Style>
<!-- Define your Styles here -->
</Style>
</TextBlock.Style>
<TextBlock>
As you can see above, You can expand Style XAML attribute into inner tag.
==EDIT==
I now understand your intention. You probably want to apply Converter in a hierarchical inheritance manner like a DataContext works.
Sadly, as far as I know, that is NOT possible under XAML. Because each Binding is just a property so that it has to be applied one-by-one.
Possible workaround is to use code-behind to enumerate elements and apply them.
for(int i=0;i<3;i++){
var textbox = (TextBox)this.FindName("TextBox" + i);
var binding = new Binding("IsTrue" + i);
binding.Converter = new YourDefaultConverter();
textbox.SetBinding(TextBox.TextProperty, binding);
}
hope this helps to reduce your chores.

How to get the language specific messages using google closure template

Am trying to implement internationalization support to my project for this people suggested google Closure Templates.but am very new to closure templates.am trying to get the language specific messages using closure template but am not getting in xlf file.If any one knows how to generate language specific messages using closure template, please tell me the steps.that's great help to me.
My .soy file code as bellow.
{namespace poc}
/**
*Testing message translation
*#param pageTitle
*/
{template .translate}
<HTML>
<Head>
<title>{$pageTitle}
</title>
</head>
<div>
{msg desc="Hello"}Hello{/msg}
</div>
</html>
{/template}
and generated .xlf content as bellow
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="SoyMsgBundle" datatype="x-soy-msg-bundle" xml:space="preserve" source-language="en" target-language="pt-BR">
<body>
<trans-unit id="2286494898080570401" datatype="html">
<source>Thanks</source>
<target/>
<note priority="1" from="description">Says thanks</note>
</trans-unit>
</body>
</file>
</xliff>
I see you already used the SoyMsgExtractor to create the base xlf. Next you need to make translations of this base xlf to the languages you want to support. A file for each language is created. I used the xliff exitor from Translution. http://sourceforge.net/projects/eviltrans.
Next, using the SoyToJsSrcCompiler a translation soy can be made per language:
java -jar SoyToJsSrcCompiler.jar --shouldGenerateGoogMsgDefs --bidiGlobalDir 1 --messageFilePathFormat Filename_en-us.xliff --outputPathFormat FileName_fr.js *.soy
This will create a Filename._fr.js file that contains the compiled soy file.
Including this file instead of the original soy (or compiled) will create a localized version.
Good luck!
\Rene
i think the easiest way is to make (i.e. generate from whatever source) a separate js file which contains one messages object and reference it through an extern declared function.
it justs works and has no complicated dependencies.

Resources