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.

education.04.lang.html 9.7KB

пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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="#gen">05. Launch LFSA and generate the site</a></li>
  122. <li><a href="#summary">06. Summary</a></li>
  123. </ul>
  124. <p><a name="localization"/></p>
  125. <h2 id="01localization">01. Localization</h2>
  126. <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>
  127. <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>
  128. <ul>
  129. <li><code>pskov.cfg</code></li>
  130. <li><code>en/item.template</code></li>
  131. <li><code>en/about.md</code></li>
  132. <li><code>en/cv.md</code></li>
  133. <li><code>ru/item.template</code></li>
  134. <li><code>ru/about.md</code></li>
  135. <li><code>ru/cv.md</code></li>
  136. </ul>
  137. <p>Let's look at the contents of these files closer.</p>
  138. <p><a name="cfg"/></p>
  139. <h2 id="02investigatepskovcfgfile">02. Investigate <code>pskov.cfg</code> file</h2>
  140. <p><code>pskov.cfg</code> file has the following contents:</p>
  141. <pre><code>input = en;ru
  142. item = item.template
  143. </code></pre>
  144. <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>
  145. <p>In this case, both <code>en/</code> and <code>ru/</code> directories have their own <code>item.template</code> file.</p>
  146. <p><a name="item"/></p>
  147. <h2 id="03investigatetemplatefiles">03. Investigate template files</h2>
  148. <ul>
  149. <li><p><code>en/item.template</code> contents:</p>
  150. <pre><code>- - - - Collapsed for brevity - - - -
  151. &lt;title&gt;Serov&lt;/title&gt;
  152. &lt;/head&gt;
  153. &lt;body&gt;
  154. &lt;div id="header"&gt;
  155. &lt;strong&gt;Serov&lt;/strong&gt;
  156. &lt;a href="about.html"&gt;About me&lt;/a&gt;
  157. &lt;a href="cv.html"&gt;CV&lt;/a&gt;
  158. &lt;div id="lang"&gt;
  159. &lt;a href="../en/PSKOV_ITEM_URL"&gt;EN&lt;/a&gt;
  160. &lt;a href="../ru/PSKOV_ITEM_URL"&gt;RU&lt;/a&gt;
  161. &lt;/div&gt;
  162. &lt;/div&gt;
  163. &lt;center&gt;
  164. - - - - Collapsed for brevity - - - -
  165. </code></pre></li>
  166. <li><p><code>ru/item.template</code> contents:</p>
  167. <pre><code>- - - - Collapsed for brevity - - - -
  168. &lt;title&gt;Серов&lt;/title&gt;
  169. &lt;/head&gt;
  170. &lt;body&gt;
  171. &lt;div id="header"&gt;
  172. &lt;strong&gt;Серов&lt;/strong&gt;
  173. &lt;a href="about.html"&gt;Обо мне&lt;/a&gt;
  174. &lt;a href="cv.html"&gt;Резюме&lt;/a&gt;
  175. &lt;div id="lang"&gt;
  176. &lt;a href="../en/PSKOV_ITEM_URL"&gt;EN&lt;/a&gt;
  177. &lt;a href="../ru/PSKOV_ITEM_URL"&gt;RU&lt;/a&gt;
  178. &lt;/div&gt;
  179. &lt;/div&gt;
  180. &lt;center&gt;
  181. - - - - Collapsed for brevity - - - -
  182. </code></pre></li>
  183. </ul>
  184. <p><strong>Note</strong>: beginning and ending were collapsed for brevity.</p>
  185. <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>
  186. <p>The changes include:</p>
  187. <ul>
  188. <li>use of <code>&lt;div id="lang"&gt;...&lt;/div&gt;</code> section to present language selection</li>
  189. <li>localization of titles into English and Russian</li>
  190. </ul>
  191. <p>Language selection uses new <strong>PSKOV</strong> constant:</p>
  192. <table>
  193. <thead>
  194. <tr>
  195. <th>PSKOV constant</th>
  196. <th>Description</th>
  197. </tr>
  198. </thead>
  199. <tbody>
  200. <tr>
  201. <td><code>PSKOV_ITEM_URL</code></td>
  202. <td>Provides generated page's file name</td>
  203. </tr>
  204. </tbody>
  205. </table>
  206. <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>
  207. <p><a name="md"/></p>
  208. <h2 id="04investigatemarkdownfiles">04. Investigate Markdown files</h2>
  209. <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>
  210. <p>For example, <code>ru/cv.md</code> has the following contents:</p>
  211. <pre><code> Title: Резюме
  212. Slug: cv
  213. Здесь вы можете увидеть моё резюме в том случае, если мои произведения всё ещё вас интересуют. Я использовал современный подход ИТ для структурирования своего резюме в виде пар ключ-значение словаря (карты). Наслаждайтесь!
  214. | Ключ | Значение |
  215. |---|---|
  216. | Имя | Валентин Серов |
  217. | Возраст | 46 |
  218. | Семейное положение | Женат |
  219. | Страна | Российская Империя |
  220. | Учёба | Императорская Академия художеств |
  221. | Звания | * академик ИАХ (1898) &lt;br&gt; * действительный член ИАХ (1903) |
  222. </code></pre>
  223. <p><strong>Note</strong>: Russian page has exactly the same <code>Slug</code> value as English one.</p>
  224. <p><a name="gen"/></p>
  225. <h2 id="05launchlfsaandgeneratethesite">05. Launch LFSA and generate the site</h2>
  226. <p>Launch <a href="http://opengamestudio.org/lfsa">LFSA</a> so that it points to directory with the files we just observed:</p>
  227. <pre><code>$ /path/to/lfsa_1.0.0.py /path/to/dir/02.Language
  228. </code></pre>
  229. <p>Generate the site:</p>
  230. <ul>
  231. <li>Go to <a href="http://opengamestudio.org/pskov">Tool</a> page</li>
  232. <li>Press <code>Generate</code> button</li>
  233. <li>Open generated <code>en/about.html</code> or <code>ru/about.html</code> from the site's directory locally</li>
  234. <li>Switch language to verify language selection works fine</li>
  235. </ul>
  236. <p><a name="summary"/></p>
  237. <h2 id="06summary">06. Summary</h2>
  238. <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>
  239. <p>Introduced PSKOV constants include:</p>
  240. <table>
  241. <thead>
  242. <tr>
  243. <th>PSKOV constant</th>
  244. <th>Description</th>
  245. </tr>
  246. </thead>
  247. <tbody>
  248. <tr>
  249. <td><code>PSKOV_ITEM_URL</code></td>
  250. <td>Provides generated page's file name</td>
  251. </tr>
  252. </tbody>
  253. </table>
  254. <p></div><div class="contents"></p>
  255. <table>
  256. <thead>
  257. <tr>
  258. <th>&lt; Back</th>
  259. <th>Index</th>
  260. <th>Next &gt;</th>
  261. </tr>
  262. </thead>
  263. <tbody>
  264. <tr>
  265. <td><a href="education.03.site.html">03. Site</a></td>
  266. <td><a href="education.html">Education</a></td>
  267. <td><a href="education.05.blog.html">05. Blog</a></td>
  268. </tr>
  269. </tbody>
  270. </table>
  271. </div></center>
  272. <div id="footer">
  273. The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
  274. from <a href="http://github.com/ogstudio/site-pskov">this source code</a>.
  275. The site is hosted by <a href="https://pages.github.com">GitHub Pages</a>.
  276. </div>
  277. <script type="text/javascript">
  278. </script>
  279. </body>
  280. </html>