- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2018 04:27 AM
Hi,
I'm facing a problem where I'm unable to translate a text/content in Client controller script of a widget (Homepage Search)
I have used ng-bind:data.greeting instead of options.title in HTML
HTML code:
For e.g. I'm trying to translate the greeting message "Welcome" but unable to get it done.
Script:
Can anyone help me on this?
Sujatha V.M.
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2018 05:57 AM
If you have a message translation for "Welcome" then one of these ways should do it.
Option 1:
Option 2:
Or if you weren't using ngBind then you could also use the "${}" within the HTML template:
<h1>${Welcome} {{ user.first_name }}</h1>
The "${}" and/or gs.getMessage() is what tells the system to do the translation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2023 02:51 AM
instead of a static text can we also translate the text that is pointed to a variable using option 1 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2023 04:44 AM
@hashwanthalla- Are you able to give an example of how you're trying to use the variable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2023 12:50 AM - edited ‎11-21-2023 12:51 AM
@ChrisBurks confirmationMessage = ("your appointment ")- coming from server
and in client controller can we do this -> "${confirmationMessage}" will this translate "your appointment" text ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2023 06:34 AM
If confirmationMessage is a variable I don't think that it will. Have you tried it?
I believe the translation happens in the HTML markup field. Where behind the scenes either before rendering or while rendering there is code looking for ${ } encapsulation. When it finds this it converts the text between it.
Thus in the client controller I don't think there is anything that will negate the what comes between quotes after an assignment operator.
In your example "confirmationMessage" is a string and will be printed out as confirmationMessage unless you have a translation for the string confirmationMessage.