Merge pull request #38 from KerbsOpenSource/main
Russian language support
This commit is contained in:
commit
85fa76d845
8
Gmeek.py
8
Gmeek.py
@ -12,9 +12,11 @@ from github import Github
|
|||||||
from xpinyin import Pinyin
|
from xpinyin import Pinyin
|
||||||
from feedgen.feed import FeedGenerator
|
from feedgen.feed import FeedGenerator
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
from transliterate import translit
|
||||||
######################################################################################
|
######################################################################################
|
||||||
i18n={"Search":"Search","switchTheme":"switch theme","link":"link","home":"home","comments":"comments","run":"run ","days":" days","Previous":"Previous","Next":"Next"}
|
i18n={"Search":"Search","switchTheme":"switch theme","link":"link","home":"home","comments":"comments","run":"run ","days":" days","Previous":"Previous","Next":"Next"}
|
||||||
i18nCN={"Search":"搜索","switchTheme":"切换主题","link":"友情链接","home":"首页","comments":"评论","run":"网站运行","days":"天","Previous":"上一页","Next":"下一页"}
|
i18nCN={"Search":"搜索","switchTheme":"切换主题","link":"友情链接","home":"首页","comments":"评论","run":"网站运行","days":"天","Previous":"上一页","Next":"下一页"}
|
||||||
|
i18nRU={"Search":"Поиск","switchTheme": "Сменить тему","link":"ссылка","home":"Главная","comments":"Комментарии","run":"работает ","days":" дней","Previous":"Предыдущая","Next":"Следующая"}
|
||||||
IconList={
|
IconList={
|
||||||
"post":"M0 3.75C0 2.784.784 2 1.75 2h12.5c.966 0 1.75.784 1.75 1.75v8.5A1.75 1.75 0 0 1 14.25 14H1.75A1.75 1.75 0 0 1 0 12.25Zm1.75-.25a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-8.5a.25.25 0 0 0-.25-.25ZM3.5 6.25a.75.75 0 0 1 .75-.75h7a.75.75 0 0 1 0 1.5h-7a.75.75 0 0 1-.75-.75Zm.75 2.25h4a.75.75 0 0 1 0 1.5h-4a.75.75 0 0 1 0-1.5Z",
|
"post":"M0 3.75C0 2.784.784 2 1.75 2h12.5c.966 0 1.75.784 1.75 1.75v8.5A1.75 1.75 0 0 1 14.25 14H1.75A1.75 1.75 0 0 1 0 12.25Zm1.75-.25a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-8.5a.25.25 0 0 0-.25-.25ZM3.5 6.25a.75.75 0 0 1 .75-.75h7a.75.75 0 0 1 0 1.5h-7a.75.75 0 0 1-.75-.75Zm.75 2.25h4a.75.75 0 0 1 0 1.5h-4a.75.75 0 0 1 0-1.5Z",
|
||||||
"link":"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z",
|
"link":"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z",
|
||||||
@ -68,6 +70,8 @@ class GMEEK():
|
|||||||
self.blogBase["singeListJson"]=json.loads('{}')
|
self.blogBase["singeListJson"]=json.loads('{}')
|
||||||
if self.blogBase["i18n"]=="CN":
|
if self.blogBase["i18n"]=="CN":
|
||||||
self.i18n=i18nCN
|
self.i18n=i18nCN
|
||||||
|
elif self.blogBase["i18n"]=="RU":
|
||||||
|
self.i18n=i18nRU
|
||||||
else:
|
else:
|
||||||
self.i18n=i18n
|
self.i18n=i18n
|
||||||
|
|
||||||
@ -229,6 +233,8 @@ class GMEEK():
|
|||||||
listJsonName='postListJson'
|
listJsonName='postListJson'
|
||||||
if self.blogBase["urlMode"]=="issue":
|
if self.blogBase["urlMode"]=="issue":
|
||||||
gen_Html = self.post_dir+'{}.html'.format(str(issue.number))
|
gen_Html = self.post_dir+'{}.html'.format(str(issue.number))
|
||||||
|
elif self.blogBase["urlMode"]=="ru_translit":
|
||||||
|
gen_Html = self.post_dir+'{}.html'.format(str(translit(issue.title, language_code='ru', reversed=True)).replace(' ', '-'))
|
||||||
else:
|
else:
|
||||||
gen_Html = self.post_dir+'{}.html'.format(Pinyin().get_pinyin(issue.title))
|
gen_Html = self.post_dir+'{}.html'.format(Pinyin().get_pinyin(issue.title))
|
||||||
|
|
||||||
@ -240,6 +246,8 @@ class GMEEK():
|
|||||||
self.blogBase[listJsonName][postNum]["postTitle"]=issue.title
|
self.blogBase[listJsonName][postNum]["postTitle"]=issue.title
|
||||||
if self.blogBase["urlMode"]=="issue":
|
if self.blogBase["urlMode"]=="issue":
|
||||||
self.blogBase[listJsonName][postNum]["postUrl"]=urllib.parse.quote(self.post_folder+'{}.html'.format(str(issue.number)))
|
self.blogBase[listJsonName][postNum]["postUrl"]=urllib.parse.quote(self.post_folder+'{}.html'.format(str(issue.number)))
|
||||||
|
elif self.blogBase["urlMode"]=="ru_translit":
|
||||||
|
self.blogBase[listJsonName][postNum]["postUrl"]=urllib.parse.quote(self.post_folder+'{}.html'.format(str(translit(issue.title, language_code='ru', reversed=True)).replace(' ', '-')))
|
||||||
else:
|
else:
|
||||||
self.blogBase[listJsonName][postNum]["postUrl"]=urllib.parse.quote(self.post_folder+'{}.html'.format(Pinyin().get_pinyin(issue.title)))
|
self.blogBase[listJsonName][postNum]["postUrl"]=urllib.parse.quote(self.post_folder+'{}.html'.format(Pinyin().get_pinyin(issue.title)))
|
||||||
self.blogBase[listJsonName][postNum]["postSourceUrl"]="https://github.com/"+options.repo_name+"/issues/"+str(issue.number)
|
self.blogBase[listJsonName][postNum]["postSourceUrl"]="https://github.com/"+options.repo_name+"/issues/"+str(issue.number)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
**[简体中文](README.md)** | **English**
|
**[简体中文](README.md)** | **English** | **[Русский](README-ru.md)**
|
||||||
# Gmeek
|
# Gmeek
|
||||||
|
|
||||||
Gmeek is a Blog Generator based on `Github Pages` and `Github Issues` and `Github Actions`. No local deployment is required, and it only takes a few minutes to deploy.
|
Gmeek is a Blog Generator based on `Github Pages` and `Github Issues` and `Github Actions`. No local deployment is required, and it only takes a few minutes to deploy.
|
||||||
|
|||||||
31
README-ru.md
Normal file
31
README-ru.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
**[简体中文](README.md)** | **[English](README-en.md)** | **Русский**
|
||||||
|
# Gmeek
|
||||||
|
|
||||||
|
Gmeek это блог генератор, использующий `Github Pages` и `Github Issues` и `Github Actions`. Никакого локального развертывания не требуется, и развертывание занимает всего несколько минут.
|
||||||
|
|
||||||
|
- [Пример](http://meekdai.github.io/)
|
||||||
|
- [Журнал обновлений](https://meekdai.github.io/post/Gmeek-geng-xin-ri-zhi.html)
|
||||||
|
- [Начать работу с Gmeek](https://blog.meekdai.com/post/Gmeek-kuai-su-shang-shou.html)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Установка
|
||||||
|
1. Нажмите [Create a repository from template](https://github.com/new?template_name=Gmeek-template&template_owner=Meekdai), рекомендуемое имя репозитория - `XXX.github.io`, где `XXX` это имя вашего профиля github.
|
||||||
|
|
||||||
|
2. В репозитории выберите `Settings`, выберите `Github Actions` в следующем месте `Pages->Build and deployment->Source`.
|
||||||
|
|
||||||
|
3. Откройте issue и начните писать, далее добавьте label. После сохранения issue, содержание блога будет создано автоматически. Через некоторое время к нему можно будет получить доступ через https://XXX.github.io
|
||||||
|
|
||||||
|
Приведенная выше установка является лишь кратким руководством, некоторые детали конфигурации будут написаны позже. Если у вас есть вопросы, пожалуйста, отправьте [Issues](https://github.com/Meekdai/Gmeek/issues) в этот репозиторий.
|
||||||
|
|
||||||
|
### Особенности
|
||||||
|
|
||||||
|
- Интерфейс UI имеет то же происхождение, что и Github, только внедрен собственный CSS Github:[primer.style](https://primer.style/css)
|
||||||
|
- После завершения написания блога в Issues автоматически запускаются Actions для выполнения задач развертывания.
|
||||||
|
- Система комментариев, используется [utteranc.es](https://utteranc.es/)
|
||||||
|
|
||||||
|
### Благодарность
|
||||||
|
- [jinja2](https://jinja.palletsprojects.com/)
|
||||||
|
- [utteranc.es](https://utteranc.es/)
|
||||||
|
- [primer.style](https://primer.style/css)
|
||||||
|
- [gitblog](https://github.com/yihong0618/gitblog)
|
||||||
@ -1,4 +1,4 @@
|
|||||||
**简体中文** | **[English](README-en.md)**
|
**简体中文** | **[English](README-en.md)** | **[Русский](README-ru.md)**
|
||||||
# Gmeek
|
# Gmeek
|
||||||
|
|
||||||
一个博客框架,超轻量级个人博客模板。完全基于`Github Pages` 、 `Github Issues` 和 `Github Actions`。不需要本地部署,从搭建到写作,只需要18秒,2步搭建好博客,第3步就是写作。
|
一个博客框架,超轻量级个人博客模板。完全基于`Github Pages` 、 `Github Issues` 和 `Github Actions`。不需要本地部署,从搭建到写作,只需要18秒,2步搭建好博客,第3步就是写作。
|
||||||
|
|||||||
@ -3,3 +3,4 @@ requests
|
|||||||
xpinyin
|
xpinyin
|
||||||
feedgen
|
feedgen
|
||||||
Jinja2
|
Jinja2
|
||||||
|
transliterate
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html data-color-mode="light" data-dark-theme="{{ blogBase['nightTheme'] }}" data-light-theme="{{ blogBase['dayTheme'] }}" lang={% if blogBase['i18n']=='CN' %}"zh-CN"{% else -%}"en"{%- endif -%}>
|
<html data-color-mode="light" data-dark-theme="{{ blogBase['nightTheme'] }}" data-light-theme="{{ blogBase['dayTheme'] }}" lang={% if blogBase['i18n']=='CN' %}"zh-CN"{% elif blogBase['i18n']=='RU' %}"ru"{% else -%}"en"{%- endif -%}>
|
||||||
<head>
|
<head>
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user