LocalizingStyleSheetsForHTMLOutputs

341 views
300 views

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
341
On SlideShare
0
From Embeds
0
Number of Embeds
137
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

LocalizingStyleSheetsForHTMLOutputs

  1. 1. Localizing Style Sheets for HTML Outputs Aliza Merzel, Suite Solutions
  2. 2. Who are we? <ul><li>Our Mission </li></ul><ul><li>To increase our customers’ profitability by significantly improving the efficiency of their information development and delivery processes. </li></ul><ul><li>Qualitative Advantage </li></ul><ul><li>Content Lifecycle Implementation (CLI) is Suite Solutions’ comprehensive approach – from concept to publication – to maximizing the value of your information assets. </li></ul><ul><li>Our professionals are with you at every phase, determining, recommending and implementing the most cost-effective, flexible and long term solution for your business. </li></ul>
  3. 3. Clients and Partners Private and Confidential Suite Solutions©2009
  4. 4. Who Am I? <ul><li>Background in Computer Science </li></ul><ul><li>Experience in several document technologies over the past decade+ </li></ul><ul><ul><li>Web applications </li></ul></ul><ul><ul><li>Content management systems </li></ul></ul><ul><ul><li>publishing and document conversion technologies </li></ul></ul><ul><li>Member of Suite Solutions team since its inception </li></ul><ul><ul><li>PDF and HTML style sheet projects </li></ul></ul><ul><ul><li>FO plug-in support for PDF output </li></ul></ul><ul><ul><li>Database development </li></ul></ul><ul><ul><li>Ditaval utility </li></ul></ul><ul><ul><li>Customize Eclipse Infocenter Framework </li></ul></ul>
  5. 5. Localizing Style Sheets for HTML Outputs <ul><li>Common Problems and Solutions </li></ul><ul><li>Special Ant Parameters for Localization </li></ul><ul><li>Special Issues with CHM </li></ul>
  6. 6. Localize strings <ul><li>Problem: I have new auto-generated text ath the OT did translate. Or I have to translate to a language that isn’t in the OT </li></ul><ul><li>Solution: </li></ul><ul><li>Files for auto-generated text are found in c:ditaotxslcommon </li></ul><ul><li>Toolkit supports a large list of built-in languages and locales </li></ul><ul><ul><li>Files are named: </li></ul></ul><ul><ul><ul><li>strings-<language>-<locale>.xml </li></ul></ul></ul><ul><ul><ul><li>Example: strings-en-us.xml </li></ul></ul></ul><ul><ul><li>Strings.xml maps locales to the correct strings file. </li></ul></ul><ul><ul><li>A new mapping file can be specified in allstrings.xml using the dita.xsl.strings extension point in a plug-in </li></ul></ul><ul><ul><li>Changes made to the strings files that come with the OT will be overwritten during a toolkit upgrade, so use plugins to add your own </li></ul></ul>
  7. 7. Localize strings <ul><li>To get a string: </li></ul><ul><li>< xsl:call-template name = &quot; getString &quot; > </li></ul><ul><li>< xsl:with-param name = &quot; stringName &quot; select = &quot; 'Return to Top' &quot; /> </li></ul><ul><li></ xsl:call-template > </li></ul>
  8. 8. Localize fonts (css) <ul><li>Problem: I must use different fonts for different language. Or I must use different styling for different languages. </li></ul><ul><li>Solution: You can provide a different css based on language. </li></ul><ul><li>< condition property = &quot; args.css &quot; value = &quot; ${dita.dir}/resources/help.css &quot; > </li></ul><ul><li>< not > </li></ul><ul><li>< equals arg1 = &quot; ${document.locale} &quot; arg2 = &quot; ja_JP &quot; /> </li></ul><ul><li></ not > </li></ul><ul><li></ condition > </li></ul><ul><li>< condition property = &quot; args.css &quot; value = &quot; ${dita.dir}/resources/help-ja.css &quot; > </li></ul><ul><li>< equals arg1 = &quot; ${document.locale} &quot; arg2 = &quot; ja_JP &quot; /> </li></ul><ul><li></ condition > </li></ul>
  9. 9. Different headers and footers <ul><li>Problem: I must use different headers/footers for different language. </li></ul><ul><li>Solution: You can provide a different headers/footers based on language. </li></ul><ul><li>< condition property = &quot; args.ftr &quot; value = &quot; ${plugin.dir}${file.separator}hf${file.separator}ftr_fr.xml &quot; > </li></ul><ul><li>< and > </li></ul><ul><li>< not > </li></ul><ul><li>< equals arg1 = &quot; ${args.draft} &quot; arg2 = &quot; yes &quot; casesensitive = &quot; false &quot; /> </li></ul><ul><li></ not > </li></ul><ul><li>< or > </li></ul><ul><li>< equals arg1 = &quot; ${document.locale} &quot; arg2 = &quot; fr &quot; casesensitive = &quot; false &quot; /> </li></ul><ul><li>< equals arg1 = &quot; ${document.locale} &quot; arg2 = &quot; fr_fr &quot; casesensitive = &quot; false &quot; /> </li></ul><ul><li></ or > </li></ul><ul><li></ and > </li></ul><ul><li></ condition > </li></ul>
  10. 10. Default Language <ul><li>Problem: My company standard is to aonly apply xml:lang to the map and not individual topics. How do the topics know what language to use? </li></ul><ul><li>Solution: In this case you wll need to pass in DEFAULTLANG to the stylesheets </li></ul><ul><li>< dita:extension id = &quot; dita.conductor.xhtml.param &quot; behavior = &quot; org.dita.dost.platform.InsertAction &quot; xmlns:dita = &quot; http://dita-ot.sourceforge.net &quot; /> </li></ul><ul><li>< param name = &quot; DEFAULTLANG &quot; expression = &quot; ${document.locale} &quot; if = &quot; document.locale &quot; /> </li></ul><ul><li>Would need to get the xml:lang attribute out of the map. </li></ul><ul><li>Can do this with xsl code </li></ul><ul><li>Then load properties into ant: </li></ul><ul><li>< xmlpropertyreader file = &quot; ${dita.temp.dir}${file.separator}dita.map.lang &quot; /> </li></ul>
  11. 11. Special XSL Processing <ul><li>Problem: My company requires extra characters before/after certain elements. </li></ul><ul><li>Solution: During processing for that element, test for language </li></ul><ul><li>< span class = &quot; uicontrol &quot; > </li></ul><ul><li>< xsl:if test = &quot; starts-with($DEFAULTLANG,'ja') &quot; > </li></ul><ul><li>< xsl:attribute name = &quot; style &quot; > </li></ul><ul><li>< xsl:text > font-weight:normal </ xsl:text > </li></ul><ul><li> </ xsl:attribute > </li></ul><ul><li>< xsl:text > [ </ xsl:text > </li></ul><ul><li></ xsl:if > </li></ul><ul><li>  </li></ul><ul><li>< xsl:apply-templates /> </li></ul><ul><li>< xsl:if test = &quot; starts-with($DEFAULTLANG,'ja') &quot; > </li></ul><ul><li>< xsl:text > ] </ xsl:text > </li></ul><ul><li></ xsl:if > </li></ul><ul><li></ span > </li></ul>
  12. 12. Right-to-Left Support <ul><li>Problem: LTR phrases within RTL text don’t appear correcly </li></ul><ul><li>חברת ( Suite Solutions Ltd .) אינה אחראית </li></ul><ul><li>חברת (Suite Solutions Ltd.) אינה אחראית לשינויים </li></ul><ul><li>Problem: LTR quotes (an entire paragraph) as right-aligned when in an RTL topic. </li></ul>
  13. 13. Right-to-Left Support <ul><li>Causes: </li></ul><ul><li>When xml:lang is set to Hebrew (he-il) or Arabic (ar-ar), the OT will user commonrtl.css </li></ul><ul><li>It will also set the dir attribute on the <html> tag to “rtl” </li></ul><ul><li>This makes the entire topic RTL. </li></ul><ul><li>Solution: </li></ul><ul><li>Tag specific LTR </li></ul><ul><li>Add dir attribute, set to “ltr” </li></ul><ul><li><ph xml:lang=&quot;en-us&quot; dir=&quot;ltr&quot; >(Suite Solutions Ltd.)</ph> </li></ul><ul><li><p xml:lang=&quot;en-us&quot; dir=&quot;ltr&quot; >this is an English paragraph. this is an English paragraph. this is an English paragraph. this is an English paragraph.</p> </li></ul>
  14. 14. Localizing Style Sheets for HTML Outputs <ul><li>Common Problems and Solutions </li></ul><ul><li>Special Ant Parameters for Localization </li></ul><ul><li>Special Issues with CHM </li></ul>
  15. 15. Ant parameters - EclipseHelp <ul><li>EclipseHelp: </li></ul><ul><li>args.dita.locale - Locale used for sorting indexterms. If no locale is specified, the first occurrence of &quot;xml-lang&quot; is used as the default locale. </li></ul><ul><li>args.eclipsehelp.language – for fragments </li></ul><ul><li>args.eclipsehelp.country – for fragments </li></ul><ul><li>Based on browser language, the interface of the Infocenter will be translated and the content shown will be in the correct langauge. You need to set up the files in the correct languages. Translated content is called a “fragment” in Eclipse terminology. This is set up by language code and then country code. </li></ul>
  16. 16. Ant parameters - EclipseHelp <ul><li>Eclipse help allows you to provide localized documentation in the same Infocenter instance. Eclipse will determine the language of the user’s browser. </li></ul><ul><li>IE : Tools > Internet Options > General (Tab) > Languages (button) </li></ul><ul><li>Chrome : Customize > Under the Hood (tab) > Web Content, Change font and language Settings (button) > Languages (tab) </li></ul><ul><li>Opera : Tools > Preferences > General (tab) </li></ul><ul><li>FireFox : Tools > Content (tab) > Languages </li></ul>
  17. 17. Ant parameters: <ul><li>XHTML: no special ant parameter </li></ul><ul><li>JavaHelp: </li></ul><ul><li>args.dita.locale - Locale used for sorting indexterms. </li></ul><ul><li>If no locale is specified, the first occurrence of &quot;xml-lang&quot; is used as the default locale. </li></ul><ul><li>If no xml-lang, then defaults to en-us </li></ul><ul><li>HtmlHelp, HtmlHelp2 </li></ul><ul><li>args.dita.locale - Locale used for sorting indexterms. </li></ul><ul><li>If no locale is specified, the first occurrence of &quot;xml-lang&quot; is used as the default locale. </li></ul><ul><li>If no xml-lang, then defaults to en-us </li></ul>
  18. 18. Ant parameters – htmlhelp+ <ul><li>HtmlHelp+ </li></ul><ul><li>args.dita.locale - Locale used for sorting indexterms. </li></ul><ul><li>If no locale is specified, the first occurrence of &quot;xml-lang&quot; is used as the default locale. </li></ul><ul><li>If no xml-lang, then defaults to en-us </li></ul><ul><li>plus.htmlhelp.encoding – unless provided, defaults to charset on current machine </li></ul><ul><li>plus.htmlhelp.hhp.encoding – unless provided, defaults to plus.htmlhelp.encoding </li></ul><ul><li>plus.htmlhelp.hhc.encoding – unless provided, defaults to plus.htmlhelp.encoding </li></ul><ul><li>plus.htmlhelp.hhk.encoding – unless provided, defaults to plus.htmlhelp.encoding </li></ul>
  19. 19. Windows Code Pages By Language/Region MS932 Japanese MS936 Simplified Chinese MS949 Korean MS950 Traditional Chinese Cp1250 Eastern European (Belarusian, Croatian, Czech, Hungarian, Polish, Romanian, Serbian, Slovak, Slovenian) Cp1251 Cyrillic (Bulgarian, Russian, Serbian, Ukrainian) Cp1252 Latin-1 Cp1253 Greek Cp1254 Turkish Cp1255 Hebrew Cp1256 Arabic Cp1257 Baltic (Estonian, Latvian, Lithuanian) Cp1258 Vietnamese
  20. 20. Localizing Style Sheets for HTML Outputs <ul><li>Common Problems and Solutions </li></ul><ul><li>Special Ant Parameters for Localization </li></ul><ul><li>Special Issues with CHM </li></ul>
  21. 21. Compiling localized HTML Help <ul><li>HtmlHelp (CHM) is an ANSI based program, not Unicode. </li></ul><ul><li>All files (html, hhc, hhp, hhk) must be in the correct codepage </li></ul><ul><li>Html Help Compiler must be run under the correct ANSI Codepage. This is done through Regional Settings: </li></ul>
  22. 22. Compiling localized HTML Help
  23. 23. Compiling localized HTML Help <ul><li>Problem: </li></ul><ul><li>This can be cumbersome if you are compiling multiple help files in multiple languages. </li></ul><ul><li>This can be near impossible if you are compiling off a file server or from a CMS. </li></ul><ul><li>Solution: </li></ul><ul><li>There is a program SBAppLocale.exe, available from http://www.steelbytes.com . This is a command line clone of Microsoft AppLocale </li></ul><ul><li>The command line would need to be: </li></ul><ul><li>SBAppLocale.exe [codepage] &quot;[path to HTMLHelp Compiler]&quot; &quot;[path to hhp file]&quot; </li></ul>
  24. 24. Localizing Style Sheets for HTML Outputs <ul><li>Common Problems and Solutions </li></ul><ul><li>Special Ant Parameters for Localization </li></ul><ul><li>Special Issues with CHM </li></ul>
  25. 26. End of Localizing Style Sheets for HTML Outputs <ul><li>Be in touch! Aliza Merzel [email_address] </li></ul><ul><li>Let us know how we can help you further… </li></ul><ul><ul><li>One-on-one support and training </li></ul></ul><ul><ul><li>CMS </li></ul></ul>

×