Andreas Breitschopp
Run Internationalized HTML5 App as Native Windows Program
Slide 1 of 20
Run Internationalized HTML5 App as Native Windows Program Andreas - - PowerPoint PPT Presentation
Run Internationalized HTML5 App as Native Windows Program Andreas Breitschopp Slide 1 of 20 Andreas Breitschopp Software Consulting and Development End User Products Based on .NET Targeting the Online and Retail Market Slide 2 of 20
Slide 1 of 20
End User Products Based on .NET Targeting the Online and Retail Market Software Consulting and Development
Slide 2 of 20
Slide 3 of 20
{ "Internationalization Test": "Internationalisierungstest", "This is an Internationalization Test!": "Dies ist ein Internationalisierungstest!", "With any subtitle.": "Mit irgendeinem Untertitel.", "Show in English": "Auf Englisch anzeigen", "Show in German": "Auf Deutsch anzeigen", "Localizing the document title...": "Lokalisiere den Dokumententitel...", "Localizing other HTML tags...": "Lokalisiere andere HTML-Tags...", "Localizing done!": "Lokalisierung fertig!" }
Slide 4 of 20
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Internationalization Test</title> <link rel="localization" hreflang="de" href="lang/de.json" type="application/vnd.oftn.l10n+json"/> <script type="text/javascript" src="js/i18n.js"></script> <script type="text/javascript" src="js/script.js"></script> </head> <body onload="loaded()"> <h1 id="headertext">This is an Internationalization Test!</h1> <h2 id="subtitletext">With any subtitle.</h2> <a id="showinenglish" href="index.html?lang=en">Show in English</a> <a id="showingerman" href="index.html?lang=de">Show in German</a> </body> </html>
Slide 5 of 20
Get the I18n JavaScript library here: http://eligrey.com/blog/post/passive-localization-in-javascript One small code change is necessary: […] req.open("GET", uri, FALSE); req.send(null); if (req.status !== 200 && req.status !== 0) { // warn about error without stopping execution […]
Slide 6 of 20
var _ = function (string) { return string.toLocaleString(); }; function localizeHTMLTag(tagId) { tag = document.getElementById(tagId); tag.innerHTML = _(tag.innerHTML); }
Slide 7 of 20
function loaded() { var lang = getParameterValue("lang"); if (lang != "") String.locale = lang; alert(_("Localizing the document title...")); document.title = _(document.title); alert(_("Localizing other HTML tags...")); localizeHTMLTag("headertext"); localizeHTMLTag("subtitletext"); localizeHTMLTag("showinenglish"); localizeHTMLTag("showingerman"); alert(_("Localizing done!")); }
Slide 8 of 20
Slide 9 of 20
Slide 10 of 20
Slide 11 of 20
Slide 12 of 20
Slide 13 of 20
Slide 14 of 20
Slide 15 of 20
Slide 16 of 20
Slide 17 of 20
Slide 18 of 20
Slide 19 of 20
Software Consulting and Development
Slide 20 of 20