Confirmed users
1,016
edits
No edit summary |
No edit summary |
||
| Line 42: | Line 42: | ||
<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> | ||
| Line 70: | Line 70: | ||
<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>''' | ||
<link rel="resource" type="intl/l20n" href="./locales/main.lol" /> | |||
</head> | </head> | ||
<body> | <body> | ||
| Line 93: | Line 95: | ||
main-en-US.lol: | main-en-US.lol: | ||
<page "Page"> | |||
<page "Page"> | <discussion "Discussion"> | ||
<discussion "Discussion"> | <edit "Edit"> | ||
<edit "Edit" | |||
main-de.lol: | main-de.lol: | ||
<page "???"> | |||
<page "???"> | <discussion "???"> | ||
<discussion "???"> | <edit "???"> | ||
<edit "???" | |||
now we need to modify our HTML document to a) provide the list of available locales and b) instruct the document on where to find each locale file. | now we need to modify our HTML document to a) provide the list of available locales and b) instruct the document on where to find each locale file. | ||
| Line 111: | Line 109: | ||
HTML: | HTML: | ||
<html> | |||
<html> | <head> | ||
'''<meta http-equiv="Content-Language" Content="en-US, de">''' | |||
<script type="text/javascript;version=1.8" src="./js/l20n-xml.min.js"></script> | |||
<link rel="resource" type="intl/l20n" '''href="./locales/main-{{ locale }}.lol"''' /> | |||
</head> | |||
<body> | |||
<header> | |||
<nav> | |||
<ul> | |||
<li l10n-id="page" /> | |||
<li l10n-id="discussion" /> | |||
<li l10n-id="edit" /> | |||
</ul> | |||
</nav> | |||
</header> | |||
</body> | |||
</html> | |||
</html | |||
Now, the l20n framework will take the locales available for the document and sort them according to the user preference. In result the best locale out of the | Now, the l20n framework will take the locales available for the document and sort them according to the user preference. In result the best locale out of the available ones will be picked and loaded. | ||
We now have a fully localized document! Whoa! | We now have a fully localized document! Whoa! | ||
| Line 143: | Line 138: | ||
HTML: | HTML: | ||
<html> | |||
<html> | <head> | ||
<script type="text/javascript;version=1.8" src="./js/l20n-xml.min.js"></script> | |||
<script type="text/javascript"> | '''<script type="text/javascript"> | ||
var ctx = document.l10nCtx; | var ctx = document.l10nCtx; | ||
ctx.settings.locales = ['en-US', 'de', 'it']; | ctx.settings.locales = ['en-US', 'de', 'it']; | ||
| Line 154: | Line 148: | ||
'./locales/{{ locale }}/{{ app }}/{{ resource }}.lol | './locales/{{ locale }}/{{ app }}/{{ resource }}.lol | ||
]; | ]; | ||
</script> | </script>''' | ||
<link rel="resource" type="intl/l20n" '''href="./locales/main-{{ locale }}.lol"''' /> | |||
</head> | |||
<body> | |||
<header> | |||
<nav> | |||
<ul> | |||
<li l10n-id="page" /> | |||
<li l10n-id="discussion" /> | |||
<li l10n-id="edit" /> | |||
</ul> | |||
</nav> | |||
</header> | |||
</body> | |||
</html | </html> | ||
or, for decoupled from the document and put into separate JSON manifest: | or, for decoupled from the document and put into separate JSON manifest: | ||