We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Localize by Id

Hi,

is it possible to localize a control by it's id?

I know that i can localize a textbox with a localization-object like this:
{
"de-DE": {
"textbox": {
"placeholder": "Suchen ..."
}
}
}
This works fine. 
But what if i have multiple textboxes?

Every textbox has the same placeholder text.

Can i somehow access each textbox via id in the localization-object?

I tried to do it like this:

"textbox.id['inputSearch']": {
"placeholder": "Suchen ..."
}
But this does not seem to work.

Is there a way to set the localization for each control individually.

Thank you.


1 Reply

PO Prince Oliver Syncfusion Team February 13, 2019 07:31 PM UTC

Hi Tobias, 

Thank you for using Syncfusion products. 

We can localize the place holder value of the Textbox component for the specific culture globally not for the individual component. So, we have achieved your requirement as the work around by defined the required placeholder values for the specific culture (“de-DE“) in the localization object. After that, we have assigned the required placeholder value to the specific text box placeholder property as like in the below code example. 

[app.component.html] 
<div class="row"> 
    <div class="col-xs-6 col-sm-6 col-lg-6 col-md-6"> 
        <ejs-textbox [placeholder]="placeholder" floatLabelType="Auto" locale="de-DE"></ejs-textbox> 
    </div> 
    <div class="col-xs-6 col-sm-6 col-lg-6 col-md-6"> 
        <ejs-textbox [placeholder]="placeholder2" locale="de-DE" floatLabelType="Auto"></ejs-textbox> 
    </div> 
    <div class="col-xs-6 col-sm-6 col-lg-6 col-md-6"> 
        <ejs-textbox placeholder="Last Name" floatLabelType="Auto"></ejs-textbox> 
    </div> 
</div> 

[app.component.ts] 
export class DefaultTextboxController { 
    placeHolder: object = { 
        "de-DE": { 
            name: "Suchen ...", 
            FirstName: "Vorname" 
        } 
    } 
    public placeholder = this.placeHolder["de-DE"].name; 
    public placeholder2 = this.placeHolder["de-DE"].FirstName; 
} 

Please check the sample from the below link. 

Regards, 
Prince 


Loader.
Live Chat Icon For mobile
Up arrow icon