25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

302 satır
11KB

  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. html
  23. {
  24. font-family: sans-serif;
  25. }
  26. body
  27. {
  28. line-height: 1.5em;
  29. }
  30. body
  31. {
  32. background: #FAFAFA;
  33. }
  34. table
  35. {
  36. border-collapse: collapse;
  37. width: 100%;
  38. }
  39. table, th, td
  40. {
  41. border: 1px solid #aaa;
  42. padding: 0.5em;
  43. margin-top: 0.5em;
  44. margin-bottom: 0.5em;
  45. }
  46. code, pre
  47. {
  48. font-family: monospace, serif;
  49. font-size: 1em;
  50. color: #7f0a0c;
  51. background: #f5f5f5;
  52. white-space: pre-wrap;
  53. }
  54. video
  55. {
  56. width: 100%;
  57. }
  58. .contents
  59. {
  60. background: #FFFFFF;
  61. width: 720px;
  62. padding: 1em;
  63. margin-top: 2em;
  64. margin-bottom: 2em;
  65. border: 1px solid #E0E0E0;
  66. text-align: left;
  67. color: #444;
  68. }
  69. #footer
  70. {
  71. text-align: center;
  72. }
  73. #lang
  74. {
  75. float: right;
  76. }
  77. </style>
  78. <title>
  79. PSKOV
  80. </title>
  81. </head>
  82. <body>
  83. <div id="header">
  84. <strong id="title">PSKOV</strong>
  85. <a href="pskov_1.0.0.html">Tool</a>
  86. <a href="education.html">Education</a>
  87. <div id="lang">
  88. <a href="../en/education.04.lang.html">EN</a>
  89. <a href="../ru/education.04.lang.html">RU</a>
  90. </div>
  91. </div>
  92. <center><h1>
  93. Education: 04. Language
  94. </h1></center>
  95. <center><div class="contents">
  96. <table>
  97. <thead>
  98. <tr>
  99. <th>&lt; Back</th>
  100. <th>Index</th>
  101. <th>Next &gt;</th>
  102. </tr>
  103. </thead>
  104. <tbody>
  105. <tr>
  106. <td><a href="education.03.site.html">03. Site</a></td>
  107. <td><a href="education.html">Education</a></td>
  108. <td><a href="education.05.blog.html">05. Blog</a></td>
  109. </tr>
  110. </tbody>
  111. </table>
  112. <p></div><div class="contents"></p>
  113. <p>In this document we add language selection.</p>
  114. <p>Estimated completion time: 10 minutes.</p>
  115. <p><strong>Table of contents</strong></p>
  116. <ul>
  117. <li><a href="#localization">01. Localization</a></li>
  118. <li><a href="#cfg">02. Investigate <code>pskov.cfg</code> file</a></li>
  119. <li><a href="#item">03. Investigate template files</a></li>
  120. <li><a href="#md">04. Investigate Markdown files</a></li>
  121. <li><a href="#lfsa">05. Launch LFSA</a></li>
  122. <li><a href="#gen">06. Generate the site</a></li>
  123. <li><a href="#observe">07. Observe the site</a></li>
  124. <li><a href="#summary">08. Summary</a></li>
  125. </ul>
  126. <p><a name="localization"/></p>
  127. <h2 id="01localization">01. Localization</h2>
  128. <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>
  129. <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>
  130. <ul>
  131. <li><code>pskov.cfg</code></li>
  132. <li><code>en/item.template</code></li>
  133. <li><code>en/about.md</code></li>
  134. <li><code>en/cv.md</code></li>
  135. <li><code>ru/item.template</code></li>
  136. <li><code>ru/about.md</code></li>
  137. <li><code>ru/cv.md</code></li>
  138. </ul>
  139. <p>Let's look at the contents of these files closer.</p>
  140. <p><a name="cfg"/></p>
  141. <h2 id="02investigatepskovcfgfile">02. Investigate <code>pskov.cfg</code> file</h2>
  142. <p><code>pskov.cfg</code> file has the following contents:</p>
  143. <pre><code>input = en;ru
  144. item = item.template
  145. </code></pre>
  146. <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>
  147. <p>In this case, both <code>en/</code> and <code>ru/</code> directories have their own <code>item.template</code> file.</p>
  148. <p><a name="item"/></p>
  149. <h2 id="03investigatetemplatefiles">03. Investigate template files</h2>
  150. <ul>
  151. <li><p><code>en/item.template</code> contents:</p>
  152. <pre><code>- - - - Collapsed for brevity - - - -
  153. &lt;title&gt;Serov&lt;/title&gt;
  154. &lt;/head&gt;
  155. &lt;body&gt;
  156. &lt;div id="header"&gt;
  157. &lt;strong&gt;Serov&lt;/strong&gt;
  158. &lt;a href="about.html"&gt;About me&lt;/a&gt;
  159. &lt;a href="cv.html"&gt;CV&lt;/a&gt;
  160. &lt;div id="lang"&gt;
  161. &lt;a href="../en/PSKOV_ITEM_URL"&gt;EN&lt;/a&gt;
  162. &lt;a href="../ru/PSKOV_ITEM_URL"&gt;RU&lt;/a&gt;
  163. &lt;/div&gt;
  164. &lt;/div&gt;
  165. &lt;center&gt;
  166. - - - - Collapsed for brevity - - - -
  167. </code></pre></li>
  168. <li><p><code>ru/item.template</code> contents:</p>
  169. <pre><code>- - - - Collapsed for brevity - - - -
  170. &lt;title&gt;Серов&lt;/title&gt;
  171. &lt;/head&gt;
  172. &lt;body&gt;
  173. &lt;div id="header"&gt;
  174. &lt;strong&gt;Серов&lt;/strong&gt;
  175. &lt;a href="about.html"&gt;Обо мне&lt;/a&gt;
  176. &lt;a href="cv.html"&gt;Резюме&lt;/a&gt;
  177. &lt;div id="lang"&gt;
  178. &lt;a href="../en/PSKOV_ITEM_URL"&gt;EN&lt;/a&gt;
  179. &lt;a href="../ru/PSKOV_ITEM_URL"&gt;RU&lt;/a&gt;
  180. &lt;/div&gt;
  181. &lt;/div&gt;
  182. &lt;center&gt;
  183. - - - - Collapsed for brevity - - - -
  184. </code></pre></li>
  185. </ul>
  186. <p><strong>Note</strong>: beginning and ending were collapsed for brevity.</p>
  187. <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>
  188. <p>The changes include:</p>
  189. <ul>
  190. <li>use of <code>&lt;div id="lang"&gt;...&lt;/div&gt;</code> section to present language selection</li>
  191. <li>localization of titles into English and Russian</li>
  192. </ul>
  193. <p>Language selection uses new <strong>PSKOV</strong> constant:</p>
  194. <table>
  195. <thead>
  196. <tr>
  197. <th>PSKOV constant</th>
  198. <th>Description</th>
  199. </tr>
  200. </thead>
  201. <tbody>
  202. <tr>
  203. <td><code>PSKOV_ITEM_URL</code></td>
  204. <td>Provides generated page's file name</td>
  205. </tr>
  206. </tbody>
  207. </table>
  208. <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>
  209. <p><a name="md"/></p>
  210. <h2 id="04investigatemarkdownfiles">04. Investigate Markdown files</h2>
  211. <p><code>en/about.md</code> and <code>en/cv.md</code> files look almost exactly as <a href="education.03.site.html">before</a>. <code>ru/about.md</code> and <code>ru/cv.md</code> are simply Russian variants of corresponding pages.</p>
  212. <p>For example, <code>ru/cv.md</code> has the following contents:</p>
  213. <pre><code> Title: Резюме
  214. Slug: cv
  215. Здесь вы можете увидеть моё резюме в том случае, если мои произведения всё ещё вас интересуют. Я использовал современный подход ИТ для структурирования своего резюме в виде пар ключ-значение словаря (карты). Наслаждайтесь!
  216. | Ключ | Значение |
  217. |---|---|
  218. | Имя | Валентин Серов |
  219. | Возраст | 46 |
  220. | Семейное положение | Женат |
  221. | Страна | Российская Империя |
  222. | Учёба | Императорская Академия художеств |
  223. | Звания | * академик ИАХ (1898) &lt;br&gt; * действительный член ИАХ (1903) |
  224. </code></pre>
  225. <p><strong>Note</strong>: Russian page has exactly the same <code>Slug</code> value as English one.</p>
  226. <p><a name="lfsa"/></p>
  227. <h2 id="05launchlfsa">05. Launch LFSA</h2>
  228. <video controls poster="../vid/education.04.lang.launch-lfsa.edgy.poster.png">
  229. <source src="../vid/education.04.lang.launch-lfsa.edgy.mp4" type ="video/mp4">
  230. <source src="../vid/education.04.lang.launch-lfsa.edgy.webm" type ="video/webm">
  231. ERROR Your browser does not support HTML5 video
  232. </video>
  233. <p>Launch <a href="http://opengamestudio.org/lfsa">LFSA</a> so that it points to directory with the files we just observed:</p>
  234. <pre><code>$ /path/to/lfsa_1.0.0.py /path/to/dir/02.Language
  235. </code></pre>
  236. <p><a name="gen"/></p>
  237. <h2 id="06generatethesite">06. Generate the site</h2>
  238. <video controls poster="../vid/education.04.lang.gen.edgy.poster.png">
  239. <source src="../vid/education.04.lang.gen.edgy.mp4" type ="video/mp4">
  240. <source src="../vid/education.04.lang.gen.edgy.webm" type ="video/webm">
  241. ERROR Your browser does not support HTML5 video
  242. </video>
  243. <p>Go to <a href="http://opengamestudio.org/pskov">Tool</a> page and press <code>Generate</code> button to generate HTML files right where Markdown ones reside.</p>
  244. <p><a name="observe"/></p>
  245. <h2 id="07observethesite">07. Observe the site</h2>
  246. <video controls poster="../vid/education.04.lang.observe.edgy.poster.png">
  247. <source src="../vid/education.04.lang.observe.edgy.mp4" type ="video/mp4">
  248. <source src="../vid/education.04.lang.observe.edgy.webm" type ="video/webm">
  249. ERROR Your browser does not support HTML5 video
  250. </video>
  251. <p>Observe generated web site locally by opening <code>en/about.html</code> or <code>ru/about.html</code> and switching language.</p>
  252. <p><a name="summary"/></p>
  253. <h2 id="08summary">08. Summary</h2>
  254. <p>You have successfully added language selection. <a href="http://opengamestudio.org/pskov/sample/02.Language/en/about.html">Check out the result</a>.</p>
  255. <p>Introduced PSKOV constants include:</p>
  256. <table>
  257. <thead>
  258. <tr>
  259. <th>PSKOV constant</th>
  260. <th>Description</th>
  261. </tr>
  262. </thead>
  263. <tbody>
  264. <tr>
  265. <td><code>PSKOV_ITEM_URL</code></td>
  266. <td>Provides generated page's file name</td>
  267. </tr>
  268. </tbody>
  269. </table>
  270. <p></div><div class="contents"></p>
  271. <table>
  272. <thead>
  273. <tr>
  274. <th>&lt; Back</th>
  275. <th>Index</th>
  276. <th>Next &gt;</th>
  277. </tr>
  278. </thead>
  279. <tbody>
  280. <tr>
  281. <td><a href="education.03.site.html">03. Site</a></td>
  282. <td><a href="education.html">Education</a></td>
  283. <td><a href="education.05.blog.html">05. Blog</a></td>
  284. </tr>
  285. </tbody>
  286. </table>
  287. </div></center>
  288. <div id="footer">
  289. The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
  290. from <a href="http://github.com/ogstudio/site-pskov">this source code</a>.
  291. The site is hosted by <a href="https://pages.github.com">GitHub Pages</a>.
  292. </div>
  293. <script type="text/javascript">
  294. </script>
  295. </body>
  296. </html>