| 1 |
wakaba |
1.1 |
<!DOCTYPE HTML><html lang="en"><head><title data-lang-content="title" lang="en">Harusame — Multilingual |
| 2 |
|
|
Web page management tool</title> |
| 3 |
|
|
<link href="#author" rel="author"> |
| 4 |
|
|
<link href="#license" rel="license"> |
| 5 |
|
|
<link href="harusame-commit" rel="feed" type="application/atom+xml"> |
| 6 |
|
|
<link href="http://suika.fam.cx/www/style/html/xhtml" rel="stylesheet"> |
| 7 |
|
|
|
| 8 |
|
|
</head><body><h1 data-lang-container="" id="title"><span lang="en"><i lang="ja">Harusame</i> — Multilingual |
| 9 |
|
|
Web page management tool</span></h1> |
| 10 |
|
|
|
| 11 |
|
|
<div class="section" id="introduction"> |
| 12 |
|
|
<h2 data-lang-container=""><span lang="en">What's this?</span></h2> |
| 13 |
|
|
|
| 14 |
|
|
<p> |
| 15 |
|
|
|
| 16 |
|
|
<span lang="en"><b><i lang="ja">Harusame</i></b> extracts a version of the |
| 17 |
|
|
HTML document written in the specified natural language, from a source |
| 18 |
|
|
HTML document that contains paragraphs in multiple natural |
| 19 |
|
|
languages.</span> |
| 20 |
|
|
|
| 21 |
|
|
</p><p> |
| 22 |
|
|
|
| 23 |
|
|
<span lang="en">The document management of a multilingual Web site where |
| 24 |
|
|
there are multiple versions of a (conceptually same) document is |
| 25 |
|
|
somewhat difficult in general. If the author of an HTML document wants |
| 26 |
|
|
to edit a part of the document, then he or she has to ensure not to |
| 27 |
|
|
forget updating translations at the same time, otherwise documents in |
| 28 |
|
|
different language versions also differ in their content versions.</span> |
| 29 |
|
|
|
| 30 |
|
|
</p><p> |
| 31 |
|
|
|
| 32 |
|
|
<span lang="en">Using <b><i lang="ja">harusame</i></b>, one can generate |
| 33 |
|
|
versions of an HTML document in different language from one source |
| 34 |
|
|
HTML document that contains paragraphs written in all of those |
| 35 |
|
|
languages, such that authors no longer have to manage different |
| 36 |
|
|
content versions and different language versions in separate |
| 37 |
|
|
files.</span> |
| 38 |
|
|
|
| 39 |
|
|
</p></div> |
| 40 |
|
|
|
| 41 |
|
|
<div class="section" id="news"> |
| 42 |
|
|
<h2 data-lang-container=""><span lang="en">What's new?</span></h2> |
| 43 |
|
|
|
| 44 |
|
|
<ul> |
| 45 |
|
|
|
| 46 |
|
|
<li><time>2008-10-21</time>: |
| 47 |
|
|
<span lang="en">The first version is released!</span> |
| 48 |
|
|
|
| 49 |
|
|
</li></ul> |
| 50 |
|
|
</div> |
| 51 |
|
|
|
| 52 |
|
|
<div class="section" id="usage"> |
| 53 |
|
|
<h2 data-lang-container=""><span lang="en">Usage</span></h2> |
| 54 |
|
|
|
| 55 |
|
|
<ol> |
| 56 |
|
|
|
| 57 |
|
|
<li> |
| 58 |
|
|
|
| 59 |
|
|
<p data-lang-container=""><span lang="en">First, prepare a source HTML document |
| 60 |
|
|
<var>html-document.src</var>. The document can be marked up in HTML |
| 61 |
|
|
as usual, except for <a href="#markup-reference">the special markup |
| 62 |
|
|
for <i lang="ja">harusame</i></a> to identify alternative blocks written |
| 63 |
|
|
in various languages.</span></p><p data-lang-container=""><span lang="en">An input document might look like:</span></p><pre class="example" lang="mul"> |
| 64 |
|
|
<code><!DOCTYPE HTML> |
| 65 |
|
|
<html lang=mul> |
| 66 |
|
|
<title>Example Document</title> |
| 67 |
|
|
|
| 68 |
|
|
<h1 <mark>data-lang-container</mark>> |
| 69 |
|
|
<span <mark>lang=en</mark>>Example document</span> |
| 70 |
|
|
<span <mark>lang=ja</mark>>文書の例</span> |
| 71 |
|
|
</h1> |
| 72 |
|
|
|
| 73 |
|
|
<p <mark>data-lang-container</mark>> |
| 74 |
|
|
<span <mark>lang=en</mark>>This is an example of document with multiple languages.</span> |
| 75 |
|
|
<span <mark>lang=ja</mark>>これは複数の言語で記述された文書の例です。</span> |
| 76 |
|
|
</code></pre> |
| 77 |
|
|
|
| 78 |
|
|
</li><li> |
| 79 |
|
|
|
| 80 |
|
|
<p>Then, invoke the <code>harusame.pl</code> for each language to |
| 81 |
|
|
generate, as: |
| 82 |
|
|
|
| 83 |
|
|
</p><pre lang="en"> |
| 84 |
|
|
$ <kbd>perl harusame.pl --lang en < <var>html-document.src</var> > <var>html-document.en</var></kbd> |
| 85 |
|
|
$ <kbd>perl harusame.pl --lang ja < <var>html-document.src</var> > <var>html-document.ja</var></kbd></pre> |
| 86 |
|
|
|
| 87 |
|
|
<p>For more information on the <code>harusame.pl</code> command-line |
| 88 |
|
|
options, see <a href="bin/harusame.html">its documentation</a>. |
| 89 |
|
|
|
| 90 |
|
|
</p></li></ol> |
| 91 |
|
|
|
| 92 |
|
|
</div> |
| 93 |
|
|
|
| 94 |
|
|
<div class="section" id="markup-reference"> |
| 95 |
|
|
<h2><i lang="ja">Harusame</i> Markup Reference</h2> |
| 96 |
|
|
|
| 97 |
|
|
<p>Special markup for <i lang="ja">harusame</i> processing is |
| 98 |
|
|
represented as <code>data-lang-<var>*</var></code> attributes on HTML |
| 99 |
|
|
elements, as follows: |
| 100 |
|
|
|
| 101 |
|
|
</p><dl> |
| 102 |
|
|
|
| 103 |
|
|
<dt lang="en"><dfn id="attr-data-lang-container"><code>data-lang-container</code></dfn> |
| 104 |
|
|
|
| 105 |
|
|
</dt><dd> |
| 106 |
|
|
|
| 107 |
|
|
<p>If this attribute is specified to an HTML element, then it is |
| 108 |
|
|
treated as a container element that contains versions of the content |
| 109 |
|
|
in various languages. |
| 110 |
|
|
|
| 111 |
|
|
</p><p>An element with this attribute must contain one or more HTML |
| 112 |
|
|
elements. One of them, whose language (<code>lang</code> attribute |
| 113 |
|
|
value) matches with the language specified as <code>--lang</code> |
| 114 |
|
|
command-line option, is <i>selected</i>. If there are more than one |
| 115 |
|
|
such elements, then the first one is <i>selected</i>. If there is no |
| 116 |
|
|
element whose language matches to the <code>--lang</code> option, then |
| 117 |
|
|
the first element (of whatever language) is <i>selected</i>. |
| 118 |
|
|
|
| 119 |
|
|
</p><p>If the attribute value is <code>replace</code>, then the element |
| 120 |
|
|
itself is replaced by the <i>selected</i> element. Otherwise, the |
| 121 |
|
|
<em>content</em> of the element is replaced by the <i>selected</i> |
| 122 |
|
|
element. |
| 123 |
|
|
|
| 124 |
|
|
</p></dd><dt lang="en"><dfn id="attr-data-lang-content"><code>data-lang-content</code></dfn> |
| 125 |
|
|
|
| 126 |
|
|
<p>If this attribute is specified to an HTML element, then its content |
| 127 |
|
|
is replaced by the content of another element. |
| 128 |
|
|
|
| 129 |
|
|
</p><p>If this attribute is specified, its value must be an ID of another |
| 130 |
|
|
HTML element in the document. |
| 131 |
|
|
|
| 132 |
|
|
</p><p>A child element of the element addressed by the ID is |
| 133 |
|
|
<i>selected</i> in the similar way to the |
| 134 |
|
|
<code>data-lang-container</code> attribute. Then, the content of the |
| 135 |
|
|
element with the <code>data-lang-content</code> attribute is replaced |
| 136 |
|
|
by the text content (the value of the <code>textContent</code> DOM |
| 137 |
|
|
attribute) of the <i>selected</i> element. |
| 138 |
|
|
|
| 139 |
|
|
</p><p>If the element addressed by the ID has |
| 140 |
|
|
<code>data-lang-declaration</code> attribute, then the element will be |
| 141 |
|
|
removed from the document at the end of the whole processing. |
| 142 |
|
|
|
| 143 |
|
|
</p><p>This attribute is useful when an HTML element does not allow to |
| 144 |
|
|
insert elements as its content. For example, the content model of the |
| 145 |
|
|
<code>title</code> element does not allow child elements, so that this |
| 146 |
|
|
attribute can be used to provide translations to the |
| 147 |
|
|
<code>title</code> element content like this: |
| 148 |
|
|
|
| 149 |
|
|
</p><pre class="example" lang="mul"> |
| 150 |
|
|
<code><title <mark>data-lang-content="title-content"</mark>>Example</title> |
| 151 |
|
|
|
| 152 |
|
|
<div <mark>id="title-content" data-lang-declaration</mark>> |
| 153 |
|
|
<span lang=en>Example</span> |
| 154 |
|
|
<span lang=ja>例</span> |
| 155 |
|
|
</div> |
| 156 |
|
|
</code></pre> |
| 157 |
|
|
|
| 158 |
|
|
</dt><dt lang="en"><dfn id="attr-data-lang-declaration"><code>data-lang-declaration</code></dfn> |
| 159 |
|
|
|
| 160 |
|
|
</dt><dd> |
| 161 |
|
|
|
| 162 |
|
|
<p>This attribute indicates that the element declares a set of |
| 163 |
|
|
alternatives in various languages. |
| 164 |
|
|
|
| 165 |
|
|
</p><p>This attribute must not be used for an element that is not pointed |
| 166 |
|
|
by a <code>data-lang-content</code> attribute in the same document. |
| 167 |
|
|
|
| 168 |
|
|
</p></dd></dl> |
| 169 |
|
|
|
| 170 |
|
|
</div> |
| 171 |
|
|
|
| 172 |
|
|
<div class="section" id="examples"> |
| 173 |
|
|
<h2 data-lang-container=""><span lang="en">Example</span></h2> |
| 174 |
|
|
|
| 175 |
|
|
<p data-lang-container=""><span lang="en">This document is itself prepared using <i lang="ja">harusame</i>. <a href="readme.html.src">See the source |
| 176 |
|
|
document to learn it can be used</a>.</span></p></div> |
| 177 |
|
|
|
| 178 |
|
|
<div class="section" id="dependency"> |
| 179 |
|
|
<h2>Dependency</h2> |
| 180 |
|
|
|
| 181 |
|
|
<p>This software requires Perl 5.8 or later, as well as <a href="http://suika.fam.cx/www/manakai-core/doc/web/">manakai-core</a> |
| 182 |
|
|
and <a href="http://suika.fam.cx/www/markup/html/whatpm/readme">Whatpm</a> |
| 183 |
|
|
packages. |
| 184 |
|
|
|
| 185 |
|
|
</p></div> |
| 186 |
|
|
|
| 187 |
|
|
<div class="section" id="download"> |
| 188 |
|
|
<h2>Download</h2> |
| 189 |
|
|
|
| 190 |
|
|
<p>This software is available from <a href="http://suika.fam.cx/gate/cvs/webroot/www/harusame/">the CVS |
| 191 |
|
|
repository</a>. |
| 192 |
|
|
|
| 193 |
|
|
</p><p><a href="http://suika.fam.cx/gate/cvs/webroot/www/harusame/harusame.tar.gz?tarball=1">The |
| 194 |
|
|
tarball for the latest version</a> is also available. |
| 195 |
|
|
|
| 196 |
|
|
</p><p>There is no installer. Just copy the script file to some |
| 197 |
|
|
directory. |
| 198 |
|
|
|
| 199 |
|
|
</p></div> |
| 200 |
|
|
|
| 201 |
|
|
<div class="section" id="author"> |
| 202 |
|
|
<h2 data-lang-container=""><span lang="en">Author</span></h2> |
| 203 |
|
|
|
| 204 |
|
|
<p><a href="http://suika.fam.cx/~wakaba/who?" rel="author">Wakaba</a>.</p> |
| 205 |
|
|
</div> |
| 206 |
|
|
|
| 207 |
|
|
<div class="section" id="license"> |
| 208 |
|
|
<h2>License</h2> |
| 209 |
|
|
|
| 210 |
|
|
<p>Copyright 2008 <a href="http://suika.fam.cx/~wakaba/who?">Wakaba</a> <code class="mail"><<a href="mailto:w@suika.fam.cx" rel="author">w@suika.fam.cx</a>></code>.</p> |
| 211 |
|
|
|
| 212 |
|
|
<p>This library is free software; you can redistribute it and/or |
| 213 |
|
|
modify it under the same terms as Perl itself.</p> |
| 214 |
|
|
|
| 215 |
|
|
</div> |
| 216 |
|
|
|
| 217 |
|
|
<footer> |
| 218 |
|
|
[<a href="readme.en" hreflang="en" lang="en" rel="alternate">English</a>] |
| 219 |
|
|
[<a href="readme.ja" hreflang="ja" lang="ja" rel="alternate">日本語</a>] |
| 220 |
|
|
</footer> |
| 221 |
|
|
</body></html> |