How do I force the Microsoft Translator widget to use a specific destination language without depending on the language sent by the browser?
http://www.microsofttranslator.com/widget/
I also had the same problem so thought I'd post how I fixed it.
I found that you can simply insert the language letter code into the widget's ajax URL. For example, search the widget code for this:
"/ajax/v2/widget.aspx?mode=auto&from=en&layout=ts"
Then you can just insert "&to=de" for example, if you want to translate to German. E.g.:
"/ajax/v2/widget.aspx?mode=auto&from=en&to=de&layout=ts"
As easy as that!
Related
I have this map with an iframe on my site:
http://ecotourism.afrika-praktikum.de/zanzibarwebsite/in-kenya/elewana-elephant-pepper-camp-with-game-package/
The controls on the map appear on Spanish (for example: "ampliar mapa")
How can I change the language?
Please no API, I just want to use the iframe.
There is a list of languages in preferable order in the end of an iFrame url:
for example, "!1sru!2sen" would mean use russian language, or english language.
U can use the language parameter. Add this to your URL in frame:
&language=es
And u can check here all the language codes.
Or check this for alternative to language parameter.
The language parameter is also hashed in the iframe URL. Before you get the HTML code for sharing, access Google maps with the language parameter you need (stated below) and share afterwards. The hl parameter is for the language.
https://www.google.com/maps?hl=en
I'm passing a value which is a HTML unordered string from an interactive report to a new page, and wanting to add it to a static content region on another page (with HTML attribute set to 'yes').
However, it displays literally as shown in the image.
If I hard-code Hello <strong> World</strong> into the region it displays as expected.
Does anyone have a solution please?
You need to set the Escape special characters attribute in your report to Yes.
http://www.grassroots-oracle.com/2017/01/escape-special-characters-apex-demo.html
And perhaps your popup needs this, depending on how you implemented it.
&P1_TEXT!HTML.
http://roelhartman.blogspot.com.au/2014/09/apex-5-new-substitution-syntax-features.html
Extended substitution string can be used to escape special characters. Check out Oracle docs --> link for more information. Also, take security into account before implementing as output escaping is an important security technique to avoid Cross Site Scripting (XSS) attacks.
I know there is a list of similar questions but all handle pages without user interaction (static even though some js may be there).
Let's say we've a page the user can interact (e.g. svg than changes, or html tables with drilldown - content changes). Those interactions will change the page. Same happens in stackoverflow when entering the question...
The idea is adding a button, "convert to pdf" taking the state of the html and sending to the user back a pdf version (we've a Java server).
Using the print of the browser is not the answer I'm looking for :-).
Is this a stick in the moon ?
You would have to store the parameters that generate the HTML view (i.e. what the user clicks on, what selections they make, etc). If you can have a list of parameters that generate the HTML view, you can have a method which accepts the list of parameters (JSON post?), generates the HTML view and passes it to your PDF generating routine. I'm not too familiar with Java libraries for this purpose, but PHP has TCPDF can take html output to basically generate a PDF for you. Certainly, there are Java libraries which will allow you to do the same thing, or you can use the parameters to get a list of rows/arrays which can be iterated over and output using the PDF library of your choice.
Both iTextPDF and Aspose.PDF would allow you to do that (I've seen them used in two different projects), but there is no magic and you will have to do some work.
The steps are roughly:
Get (as a string) the part of the document which you want to print with jQuery or innerHTML
Call a service on the server side to convert this to PDF
[Serverside] Use a whitlist - based tool to clean up the hmtl (unless you want to be hacked). JSoup is great for that.
[Serverside] Use IText or Aspose API to create the PDF from the HTML (this is not trivial, you will have to read the doc)
Download the document
I'd also recommend DocRaptor, an HTML to PDF API built by my company, Expected Behavior.
DocRaptor uses Prince XML to generate PDFs, and thus produces higher quality results than similar products.
Adding PDF generation to your own web application using our service is as simple as making an HTTP POST request to our server.
Here's a link to DocRaptor's home page:
DocRaptor
And a link to our API documentation:
DocRaptor API documentation
I'm trying to add localization support to a Google Chrome Web App and, while it is easy to define strings for manifest and CSS files, it is somewhat more difficult for HTML pages.
In the manifest and in CSS files I can simply define localization strings like so:
__MSG_name__
but this doesn't work with HTML pages.
I can make a JavaScript function to fire onload that does the job like so:
document.title = chrome.i18n.getMessage("name");
document.querySelector("span.name").innerHTML = chrome.i18n.getMessage("name");
but this seems awfully ineffecient. Furthermore, I would like to be able to specify the page metadata; application-name and description, pulling the values from the localization files. What would be the best way of doing all this?
Thanks for your help.
Please refer to this documentation:
http://code.google.com/chrome/extensions/i18n.html
If you want to add localized content within HTML, you would need to do it via JavaScript as you mentioned before. That is the only way you can do it.
chrome.i18n.getMessage("name")
It isn't inefficient to do that, you can place your JavaScript at the end of the document (right before the end body tag) and it will fill up the text with respect to the locale.
Dunno if i understand exactly what you are trying to do but you could dynamically retrieve the LANG attribute (using .getAttribute("lang") or .lang) of the targeted tag and serve accordingly the proper values.
What's the best way to create printable letters from an MVC application? I'm looking for sort of a mail merge thing from my app that prints a form letter with various values filled in.
In ASP.NET, I previously did this by creating an HTML document and displaying it as application/msword, but I did that with code-behind, which isn't an (easy) option in MVC, and I don't know if that's the best method or not.
Note that this is an internal application, so it can be assumed everyone has Word on their computer. With that said, it would be nice to bypass Word, but I could go either way. The simpler the better. Any ideas/methods welcome.
Since this is just HTML with the ContentType set to application/msword I can't see any reason why you would want to use code-behind.
A standard MVC view with a typical HTML template peppered with appropriate <%=...> where view data needs to be inserted would seem to be the sensible approach. Even where you might want to loop.
BTW, why isn't code-behind an easy option?
In your controller:
return Content(contentGoesHere, "application/msword");