How can I use dynamic values in a language generation template? - azure

I would like to re-use a given set of "language generation" sentences in bot composer, while filling it with localized values.
See my example execution + LG template, which does not work.
--> the target LG template
${defaultResponse("Yes")}
--> the source LG template
defaultResponse(defaultValue)
I did not understand your input, so I have made a decision for you and answered the question with "${defaultValue}".
Any idea what I do wrong? I do not find something similar in the documentation.

To create bot with different languages, there is a function called Multilingual support. It's introduced in document here: https://learn.microsoft.com/en-us/composer/how-to-use-multiple-language
The structure looks like as below when you created bot with Chinese and English.
/coolbot
coolbot.dialog
/language-generation
/en-us
common.en-us.lg
coolbot.en-us.lg
/zh-cn
common.zh-cn.lg
coolbot.zh-cn.lg
/language-understanding
/en-us
coolbot.en-us.lu
/zh-cn
coolbot.zh-cn.lu

Related

Sirius - Create graphical interface to xtext template language

in my project we use a Xtext template language to create some documents.
Similar to whats written here:
https://www.eclipse.org/Xtext/documentation/207_template.html
So basically a template starts with a « and ends with a »
In between we call xtend functions which define what will be visible in the output html document.
We would like to add a graphical editor to the already existing textual one.
I saw that Sirius can interact with Xtext and found the examples quite interesting.
What I could not figure out was how to tell Sirius to use my already existing xtend functions.
My question is: Is there a way to create a graphical interface for a xtedt template language with sirius or am i running in a dead end?
Thanks in advance
This seems doable, however it is not clear what you mean by "how to tell Sirius to use my already existing xtend functions". Maybe you could start by providing an example of what your templates look like, and the kind of representation you expect to have.
If I refer to the Xtext example you link, an Xtend function call in your template is an XBlockExpression. You would thus need to specify in Sirius an adequate representation for this metaclass.
Links that may help can be found here: https://www.eclipse.org/forums/index.php/t/1090448/

Searching across multiple languages -- how to?

TLDR: I wanna build multi-language search on my website ala Pinterest, how do I do that?
I am starting a website, where people can publish content that gets metadata typed by the user. People can then interact with the content by looking at it, liking it, commenting on it, sharing it to social media. Also content discovery is mostly done through search.
I do not wish to create geographic boundaries on my website. I would like people who speak any language to find content that is relevant to them in any language. This requirement makes sense because the content is highly visual, ala Pinterest. So even if I don't understand that the word "car" is written in French in the description, it's fine because I'll mostly be interested in seeing the car.
Pinterest is really really good with search across language. For example, on uk.pinterest.com I typed "coupe carrée" which is the French for "bob haircut" and all the results are visually relevant. Even if the pin metadata is in English and the original web site is all in English.
How is that possible? how was Pinterest able to match to my french search query content whose text is all in English? is there translation at some step: coupe carrée > bob haircut > content containing "bob haircut"?
I looked at their engineering blog and all I found is tech to detect the original country and language of a website. Nothing about managing language in search.
please let me know if this is the wrong place to ask the how-it-works question.
Thanks in advance for any help/pointers you will be able to share!
The general strategy in this case is to index your content with every language translation you wish to search.
This would require use of a language translation API at index-time. And a language identification model. Here's a Solr example.

Fetch WorkflowTemplate for different language

I need to fetch the OOB approval workflow from current web to associate it with my custom list
I tried to fetch it through BaseId but then i got to know that BaseId is not the same for different languages.
Is there any other way to fetch the OOB approval workflow's template for sites created on different languages?
I have also tried GetTemplateByName method but its returning null for any language other than English also.
web.WorkflowTemplates.GetTemplateByName("Approval - SharePoint 2010", CultureInfo.CurrentCulture)
Any help would be appreciated.
Thanks
Sanjay
I solved this problem myself.
As i mentioned in my question, the BaseId varies from language to language. After trying out different methods and googling it, i didn't find any solution to the problem, so i started investigating it myself.
During my investigation, I fetched the BaseId for approval workflow for different languages and soon a pattern emerged. It turned out that BaseId (Guid) is almost same for every language except last three digits and those three digits were basically hexadecimal representation of LCID !!
So, this is how template based id can be formed
string baseId = "8ad4d8f0-93a7-4941-9657-cf3706f00" + web.Language.ToString("X");
Guid workflowBaseId = new Guid(baseId);
so, once we have the base id, we can use the same method to retrieve the template:
web.WorkflowTemplates.GetTemplateByBaseID(workflowBaseId);
I also wrote the blog post on this one here, in case you would like to see the entire piece of code for workflow association: http://sanjaybhagia.wordpress.com/2013/10/20/associating-oob-approval-workflow-with-custom-list-for-different-locale-lcids/
Hope it helps.
Regards,
Sanjay

Multilingual solution

Two questions, hopefully with similar answers.
I'll be releasing a JavaScript package in my solution where the error messages are to be displayed. The problems is that I'll be targeting German, English and French. Possibly, also a fourth language TBD. What would be the nicest way to resolve this?
The label names should definitely be localized. Is there a built-in approach to that in CRM 2011? Like a resource table or something like that?
My current solution for (1) is to keep an extra web resource with the strings and distributing a different file for each language. I may rebuild it and distribute all the languages at once and only use a parameter, possibly settable from the GUI if I create a settings-entity. A bit cumbersome.
My current solution for (2) involves a lot of praying and a divine act of some sort. :)
To determine current CRM user language dynamically from Javascript you can use window.USER_LANGUAGE_CODE (this variable exists on all CRM pages) - for example it will be equal 1033 for English. Than based on that info, you can pick needed string resources from your file.
Also in forms context there are two predefined functions, which return current Organization language code and current User language code: Xrm.Page.context.getOrgLcid() and
Xrm.Page.context.getUserLcid() .
If you are talking about custom entities and fields, you can easily add localized display names for them via your solution. You need to edit customizations.xml file from your unzipped solution. For each attribute there you will find such XML containing display names:
<displaynames>
<displayname description="Created By" languagecode="1033" />
</displaynames>
You can just add new display names for each language you need there.
P.S. If someone interested in different aspects of multilangual support for Dynamics CRM 2011 solutions, I strongly recommend to review this page, also here and here is a very helpful reading.

Quiz creator and sharepoint

Hi there i want to use a quiz creator software like quiz creator or articulate
My problem is that i want to save quiz results to sharepoint lists.
like : quizname : xx
quiztaker: yy
quiztime : x
correct answers: 5
wrong answers : 7 etc.
Is there any way to achieve this,or is there any open source .net quiz maker like these utilities to save the results in a custom place like sql server or sp lists.
If you're still looking to achieve something like this, SPServices is a jQuery library that makes SharePoint's web services easier to use. It has helped some people achieve some very nice functionality, like a Custom Quizzing System. The original author worked with the developer of SPServices to get this feature working for a school environment. It is an HTML page with JavaScript and jQuery that saves the results to a SP List.
You'll need to make some major modifications to it (ie. update references to .js libs, replace all instances of document.write, etc.) but with some work you could achieve what you're looking for, and probably more.

Resources