You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

252 lines
8.7KB

  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <head>
  5. <style>
  6. #header
  7. {
  8. background: #856d51;
  9. padding: 0.7em;
  10. text-align: left;
  11. }
  12. #header a
  13. {
  14. color: white;
  15. text-decoration: none;
  16. padding: 0.5em 1em 0.5em 1em;
  17. }
  18. #title
  19. {
  20. color: #433729;
  21. }
  22. iframe
  23. {
  24. width: 720px;
  25. height: 720px;
  26. }
  27. html
  28. {
  29. font-family: sans-serif;
  30. }
  31. body
  32. {
  33. line-height: 1.5em;
  34. }
  35. body
  36. {
  37. background: #FAFAFA;
  38. }
  39. table
  40. {
  41. border-collapse: collapse;
  42. width: 100%;
  43. }
  44. table, th, td
  45. {
  46. border: 1px solid #aaa;
  47. padding: 0.5em;
  48. margin-top: 0.5em;
  49. margin-bottom: 0.5em;
  50. }
  51. code, pre
  52. {
  53. font-family: monospace, serif;
  54. font-size: 1em;
  55. color: #7f0a0c;
  56. background: #f5f5f5;
  57. white-space: pre-wrap;
  58. }
  59. .contents
  60. {
  61. background: #FFFFFF;
  62. width: 720px;
  63. padding: 1em;
  64. margin-top: 2em;
  65. margin-bottom: 2em;
  66. border: 1px solid #E0E0E0;
  67. text-align: left;
  68. color: #444;
  69. }
  70. </style>
  71. <title>
  72. PSKOV - Opensource Game Studio static site generator
  73. </title>
  74. </head>
  75. <body>
  76. <div id="header">
  77. <strong id="title">PSKOV</strong>
  78. <a href="index.html">Tool</a>
  79. <a href="education.html">Education</a>
  80. </div>
  81. <center><h1>
  82. Education: 04. Language
  83. </h1></center>
  84. <center><div class="contents">
  85. <table>
  86. <thead>
  87. <tr>
  88. <th>&lt; Back</th>
  89. <th>Index</th>
  90. <th>Next &gt;</th>
  91. </tr>
  92. </thead>
  93. <tbody>
  94. <tr>
  95. <td><a href="education.03.site.html">03. Site</a></td>
  96. <td><a href="education.html">Education</a></td>
  97. <td><a href="education.05.blog.html">05. Blog</a></td>
  98. </tr>
  99. </tbody>
  100. </table>
  101. <p></div><div class="contents"></p>
  102. <p>In this document we add language selection.</p>
  103. <p>Estimated completion time: ? minutes.</p>
  104. <p><strong>Table of contents</strong></p>
  105. <ul>
  106. <li><a href="#localization">01. Localization</a></li>
  107. <li><a href="#cfg">02. Investigate <code>cfg</code> file</a></li>
  108. <li><a href="#item">03. Investigate template files</a></li>
  109. <li><a href="#md">04. Investigate Markdown files</a></li>
  110. <li><a href="#gen">05. Launch LFSA and generate the site</a></li>
  111. </ul>
  112. <p><a name="localization"/></p>
  113. <h2 id="01localization">01. Localization</h2>
  114. <p>Now that you have your web site in English you start to wonder why there's no Russian version, you're Russian after all!</p>
  115. <p>You set on to create the following <a href="https://github.com/OGStudio/site-pskov-sample/tree/master/02.Language">directory structure</a>:</p>
  116. <ul>
  117. <li><code>cfg</code></li>
  118. <li><code>en/item.template</code></li>
  119. <li><code>en/index.md</code></li>
  120. <li><code>en/cv.md</code></li>
  121. <li><code>ru/item.template</code></li>
  122. <li><code>ru/index.md</code></li>
  123. <li><code>ru/cv.md</code></li>
  124. </ul>
  125. <p>Let's look at the contents of these files closer.</p>
  126. <p><a name="cfg"/></p>
  127. <h2 id="02investigatecfgfile">02. Investigate <code>cfg</code> file</h2>
  128. <p><code>cfg</code> file has the following contents:</p>
  129. <pre><code>input = en;ru
  130. item = item.template
  131. </code></pre>
  132. <p>As you see, <code>input</code> can accept multiple directories separated by <code>;</code> symbol: <strong>PSKOV</strong> will go over each directory specified and run as before.</p>
  133. <p>In this case, both <code>en/</code> and <code>ru/</code> directories have their own <code>item.template</code> file.</p>
  134. <p><a name="item"/></p>
  135. <h2 id="03investigatetemplatefiles">03. Investigate template files</h2>
  136. <ul>
  137. <li><p><code>en/item.template</code> contents:</p>
  138. <pre><code>- - - - Collapsed for brevity - - - -
  139. &lt;title&gt;Serov&lt;/title&gt;
  140. &lt;/head&gt;
  141. &lt;body&gt;
  142. &lt;div id="header"&gt;
  143. &lt;strong&gt;Serov&lt;/strong&gt;
  144. &lt;a href="index.html"&gt;About me&lt;/a&gt;
  145. &lt;a href="cv.html"&gt;CV&lt;/a&gt;
  146. &lt;div id="lang"&gt;
  147. &lt;a href="../en/PSKOV_ITEM_URL"&gt;EN&lt;/a&gt;
  148. &lt;a href="../ru/PSKOV_ITEM_URL"&gt;RU&lt;/a&gt;
  149. &lt;/div&gt;
  150. &lt;/div&gt;
  151. &lt;center&gt;
  152. - - - - Collapsed for brevity - - - -
  153. </code></pre></li>
  154. <li><p><code>ru/item.template</code> contents:</p>
  155. <pre><code>- - - - Collapsed for brevity - - - -
  156. &lt;title&gt;Серов&lt;/title&gt;
  157. &lt;/head&gt;
  158. &lt;body&gt;
  159. &lt;div id="header"&gt;
  160. &lt;strong&gt;Серов&lt;/strong&gt;
  161. &lt;a href="index.html"&gt;Обо мне&lt;/a&gt;
  162. &lt;a href="cv.html"&gt;Резюме&lt;/a&gt;
  163. &lt;div id="lang"&gt;
  164. &lt;a href="../en/PSKOV_ITEM_URL"&gt;EN&lt;/a&gt;
  165. &lt;a href="../ru/PSKOV_ITEM_URL"&gt;RU&lt;/a&gt;
  166. &lt;/div&gt;
  167. &lt;/div&gt;
  168. &lt;center&gt;
  169. - - - - Collapsed for brevity - - - -
  170. </code></pre></li>
  171. </ul>
  172. <p><strong>Note</strong>: beginning and ending were collapsed for brevity.</p>
  173. <p>As you can see, both <code>en/item.template</code> and <code>ru/item.template</code> look similar to <code>item.template</code> we saw <a href="education.03.site.html">before</a>.</p>
  174. <p>The changes include:</p>
  175. <ul>
  176. <li>use of <code>&lt;div id="lang"&gt;...&lt;/div&gt;</code> section to present language selection</li>
  177. <li>localization of titles into English and Russian</li>
  178. </ul>
  179. <p>Language selection uses new <strong>PSKOV</strong> constant:</p>
  180. <table>
  181. <thead>
  182. <tr>
  183. <th>PSKOV constant</th>
  184. <th>Description</th>
  185. </tr>
  186. </thead>
  187. <tbody>
  188. <tr>
  189. <td><code>PSKOV_ITEM_URL</code></td>
  190. <td>Provides <code>&lt;slug&gt;.html</code> value for the page</td>
  191. </tr>
  192. </tbody>
  193. </table>
  194. <p>As you see, <code>PSKOV_ITEM_URL</code> is all you need to have your page in as many languages as you please.</p>
  195. <p><a name="md"/></p>
  196. <h2 id="04investigatemarkdownfiles">04. Investigate Markdown files</h2>
  197. <p><code>en/index.md</code> and <code>en/cv.md</code> files look exactly as <a href="education.03.site.html">before</a>. <code>ru/index.md</code> and <code>ru/cv.md</code> are simply Russian variants of the same pages.</p>
  198. <p>For example, <code>ru/cv.md</code> has the following contents:</p>
  199. <pre><code> Title: Резюме
  200. Slug: cv
  201. Здесь вы можете увидеть моё резюме в том случае, если мои произведения всё ещё вас интересуют. Я использовал современный подход ИТ для структурирования своего резюме в виде пар ключ-значение словаря (карты). Наслаждайтесь!
  202. | Ключ | Значение |
  203. |---|---|
  204. | Имя | Валентин Серов |
  205. | Возраст | 46 |
  206. | Семейное положение | Женат |
  207. | Страна | Российская Империя |
  208. | Учёба | Императорская Академия художеств |
  209. | Звания | * академик ИАХ (1898) &lt;br&gt; * действительный член ИАХ (1903) |
  210. </code></pre>
  211. <p><strong>Note</strong>: Russian page has exactly the same <code>Slug:</code> value as English one.</p>
  212. <p><a name="gen"/></p>
  213. <h2 id="05launchlfsaandgeneratethesite">05. Launch LFSA and generate the site</h2>
  214. <p>Launch LFSA so that it points to directory with the files we just observed:</p>
  215. <pre><code>$ /path/to/local-file-system-access.py /path/to/dir/02.Language
  216. </code></pre>
  217. <p>Generate the site:</p>
  218. <ul>
  219. <li>Go to <a href="http://opengamestudio.org/pskov">Tool</a> page</li>
  220. <li>Press <code>Generate</code> button</li>
  221. <li>Open generated <code>en/index.html</code> or <code>ru/index.html</code> from the site's directory locally</li>
  222. <li>Switch language to verify language selection works fine</li>
  223. </ul>
  224. <p>Take time to observe just how little effort you spent to have your web site localized.</p>
  225. <p></div><div class="contents"></p>
  226. <table>
  227. <thead>
  228. <tr>
  229. <th>&lt; Back</th>
  230. <th>Index</th>
  231. <th>Next &gt;</th>
  232. </tr>
  233. </thead>
  234. <tbody>
  235. <tr>
  236. <td><a href="education.03.site.html">03. Site</a></td>
  237. <td><a href="education.html">Education</a></td>
  238. <td><a href="education.05.blog.html">05. Blog</a></td>
  239. </tr>
  240. </tbody>
  241. </table>
  242. </div></center>
  243. <script type="text/javascript">
  244. </script>
  245. </body>
  246. </html>