L20n/HTML: Difference between revisions

6 bytes removed ,  8 September 2012
no edit summary
(Created page with "= Intro = This document is a tutorial on how to use L20n to localize your HTML web aplication. == Initial setup == We'll operate on an example of a very simple HTML5 document ...")
 
No edit summary
Line 33: Line 33:


The last piece of the equation is to bind the HTML nodes to their respective localizable elements (called entities) by setting an ''l10n-id'' attribute on each node.
The last piece of the equation is to bind the HTML nodes to their respective localizable elements (called entities) by setting an ''l10n-id'' attribute on each node.
main.lol:
<page "Page">
<discussion  "Discussion">
<edit "Edit">


HTML:
HTML:
<pre>
<html>
<html>
  <head>
  <head>
    '''<link rel="resource" type="intl/l20n" href="./locales/main.lol"''' />
    <link rel="resource" type="intl/l20n" href="./locales/main.lol"
  </head>
  </head>
  <body>
  <body>
    <header>
    <header>
      <nav>
      <nav>
        &lt;ul>
        <ul>
          &lt;li '''l10n-id="page"''' />
          <li l10n-id="page" />
          &lt;li '''l10n-id="discussion"''' />
          <li l10n-id="discussion" />
          &lt;li '''l10n-id="edit"''' />
          <li l10n-id="edit" />
        &lt;/ul>
        </ul>
      </nav>
      </nav>
    </header>
    </header>
  </body>
  </body>
</html>
</html>
 
</pre>
 


main.lol:
<pre>
<page "Page">
<discussion  "Discussion">
<edit "Edit">
</pre>


With this change, we now have our document localizable!
With this change, we now have our document localizable!
Line 68: Line 67:


HTML:
HTML:
<pre>
<html>
<html>
  <head>
  <head>
    '''<script type="text/javascript;version=1.8" src="./js/l20n-xml.min.js"></script>'''
    <script type="text/javascript;version=1.8" src="./js/l20n-xml.min.js"></script>
  </head>
  <body>
    <header>
      <nav>
        &lt;ul>
          &lt;li l10n-id="page" />
          &lt;li l10n-id="discussion" />
          &lt;li l10n-id="edit" />
        &lt;/ul>
      </nav>
    </header>
  </body>
</html>


    <link rel="resource" type="intl/l20n" href="./locales/main.lol"
  </head>
  <body>
    <header>
      <nav>
        <ul>
          <li l10n-id="page" />
          <li l10n-id="discussion" />
          <li l10n-id="edit" />
        </ul>
      </nav>
    </header>
  </body>
</html>
</pre>


== Pick a language ==
== Pick a language ==
Confirmed users
1,016

edits