New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization of a date format and adding Russian language #815

Closed
RAlexeev opened this Issue Feb 5, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@RAlexeev

RAlexeev commented Feb 5, 2017

Hello, Michael!

Many thanks for the flexible and useful theme for Jekyll. I would like to help you to translate your theme for Russian users. I hope, it helps you and other russian users of your theme.

At first, please add the code below to _data/ui-text.yml:

# Russian / Русский
# -----------------
ru: &DEFAULT_RU
  page                       : "Страница"
  pagination_previous        : "Предыдущая"
  pagination_next            : "Следующая"
  breadcrumb_home_label      : "Главная"  # Домашняя страница
  breadcrumb_separator       : "/"
  menu_label                 : "Выпадающее меню"
  toc_label                  : "Содержание"
  ext_link_label             : "Прямая ссылка"
  less_than                  : "меньше"
  minute_read                : "минут(ы) на чтение"
  share_on_label             : "Поделиться"
  meta_label                 :
  tags_label                 : "Метки:"   # "Теги:" / "Тэги:"
  categories_label           : "Разделы:"  # Категории:
  date_label                 : "Дата изменения:"  # Опубликовано:
  comments_label             : "Оставить комментарий"
  comments_title             : "Комментарии"
  more_label                 : "Читать далее" # "Далее" / "Подробнее" / "Читать дальше"
  related_label              : "Вам также может понравиться"
  follow_label               : "Связаться со мной:"  # Подписаться:
  feed_label                 : "RSS-лента"
  powered_by                 : "Сайт работает на" # Работает на
  website_label              : "Сайт"   # Веб-сайт
  email_label                : "Электронная почта"
  recent_posts               : "Свежие записи"  # "Последние записи" / "Свежие посты"
  undefined_wpm              : "Не определён параметр words_per_minute в _config.yml"
  comment_form_info          : "Ваш адрес электронной почты не будет опубликован. Обязательные поля помечены"
  comment_form_comment_label : "Комментарий"
  comment_form_md_info       : "Поддерживается синтаксис Markdown."
  comment_form_name_label    : "Имя"
  comment_form_email_label   : "Электронная почта"  # "Адрес электронной почты" / "Email адрес"
  comment_form_website_label : "Ссылка на сайт (необязательно)"
  comment_btn_submit         : "Оставить комментарий"   # Отправить комментарий
  comment_btn_submitted      : "Отправлено"  # Комментарий отправлен
  comment_success_msg        : "Спасибо за Ваш комментарий! Он будет опубликован на сайте после проверки."
  comment_error_msg          : "К сожалению, произошла ошибка с отправкой комментария. Пожалуйста, убедитесь, что все обязательные поля заполнены и попытайтесь снова."
  loading_label              : "Отправка..."    # Загрузка...
ru-RU:
  <<: *DEFAULT_RU

Secondly, it would be convenient to provide an additional date format, like "Day MonthNotEnglish Year". For example, in Russian it should be 10 марта 2016 instead of March 09, 2016. I decide this problem in the following way. I edited the file _layouts/single.html like this:

        {% if page.modified %}
          <p class="page__date"><strong><i class="fa fa-fw fa-calendar" aria-hidden="true"></i> {{ site.data.ui-text[site.locale].date_label | default: "Updated:" }}</strong>
            <time datetime="{{ page.modified | date: "%Y-%m-%d" }}">
              {{ page.modified | date: "%-d" }}
              {% assign month = page.modified | date: '%-m' %}
              {% case month %}
                {% when '1' %}января
                {% when '2' %}февраля
                {% when '3' %}марта
                {% when '4' %}апреля
                {% when '5' %}мая
                {% when '6' %}июня
                {% when '7' %}июля
                {% when '8' %}августа
                {% when '9' %}сентября
                {% when '10' %}октября
                {% when '11' %}ноября
                {% when '12' %}декабря
              {% endcase %}
              {{ page.modified | date: "%Y" }}
            </time>
          </p>
        {% elsif page.date %}
          <p class="page__date"><strong><i class="fa fa-fw fa-calendar" aria-hidden="true"></i> {{ site.data.ui-text[site.locale].date_label | default: "Updated:" }}</strong>
            <time datetime="{{ page.date | date_to_xmlschema }}">
              {{ page.date | date: "%-d" }}
              {% assign month = page.date | date: '%-m' %}
              {% case month %}
                {% when '1' %}января
                {% when '2' %}февраля
                {% when '3' %}марта
                {% when '4' %}апреля
                {% when '5' %}мая
                {% when '6' %}июня
                {% when '7' %}июля
                {% when '8' %}августа
                {% when '9' %}сентября
                {% when '10' %}октября
                {% when '11' %}ноября
                {% when '12' %}декабря
              {% endcase %}
              {{ page.date | date: "%Y" }}
            </time>
          </p>
        {% endif %}
      </footer>

Maybe you could provide more flexible way by using config and name of month for each language:

months:
  January: "января"
  February: "февраля"
  March: "марта"
  April: "апреля"
  May: "мая"
  June: "июня"
  July: "июля"
  August: "августа"
  September: "сентября"
  October: "октября"
  November: "ноября"
  December: "декабря"

Have a nice day and good luck!

@mmistakes

This comment has been minimized.

Show comment
Hide comment
@mmistakes

mmistakes Feb 5, 2017

Owner

Thanks for the translations. I'll definitely add them to the next release.

As far as localizing the date. Ideally Jekyll core would support it instead of having to resort to a bunch of Liquid code. Something like this was proposed but appears to have gone stale jekyll/jekyll#5478

Owner

mmistakes commented Feb 5, 2017

Thanks for the translations. I'll definitely add them to the next release.

As far as localizing the date. Ideally Jekyll core would support it instead of having to resort to a bunch of Liquid code. Something like this was proposed but appears to have gone stale jekyll/jekyll#5478

@mmistakes mmistakes self-assigned this Feb 5, 2017

@RAlexeev

This comment has been minimized.

Show comment
Hide comment
@RAlexeev

RAlexeev Feb 5, 2017

Thank you! It will be really great, if Jekyll supports date formatting natively.

RAlexeev commented Feb 5, 2017

Thank you! It will be really great, if Jekyll supports date formatting natively.

@RAlexeev

This comment has been minimized.

Show comment
Hide comment
@RAlexeev

RAlexeev Feb 6, 2017

I have to admit, that I have found one mistake in russian "read time". In case of exactly "1 minute read" there is not right ending in russian text "1 минут(ы) на чтение". It should be "1 минута на чтение". So, there are 3 case:

  • "1 минута на чтение"
  • "менее 1 минуты на чтение"
  • "менее 2 минут на чтение"

But option minute_read : "минут(аы) на чтение" looks not good. May be the better way is to use abbreviations for minute "мин" like this:

  less_than                  : "менее"
  minute_read                : "мин на чтение"

Additionally, I think to change less_than : "меньше" to less_than : "менее".

I'm sorry for the confusion.

RAlexeev commented Feb 6, 2017

I have to admit, that I have found one mistake in russian "read time". In case of exactly "1 minute read" there is not right ending in russian text "1 минут(ы) на чтение". It should be "1 минута на чтение". So, there are 3 case:

  • "1 минута на чтение"
  • "менее 1 минуты на чтение"
  • "менее 2 минут на чтение"

But option minute_read : "минут(аы) на чтение" looks not good. May be the better way is to use abbreviations for minute "мин" like this:

  less_than                  : "менее"
  minute_read                : "мин на чтение"

Additionally, I think to change less_than : "меньше" to less_than : "менее".

I'm sorry for the confusion.

@kafran

This comment has been minimized.

Show comment
Hide comment
@kafran

kafran Feb 20, 2017

Is it possible to have a multiple language site?

kafran commented Feb 20, 2017

Is it possible to have a multiple language site?

@mmistakes

This comment has been minimized.

Show comment
Hide comment
@mmistakes

mmistakes Feb 20, 2017

Owner

Not without some work on your part. You'll need to use a plugin or do something like the following.

Owner

mmistakes commented Feb 20, 2017

Not without some work on your part. You'll need to use a plugin or do something like the following.

@kafran

This comment has been minimized.

Show comment
Hide comment
@kafran

kafran Feb 20, 2017

Thank you. I will try it.

kafran commented Feb 20, 2017

Thank you. I will try it.

@mmistakes mmistakes closed this in 3fb3531 Feb 21, 2017

antonizoon pushed a commit to antonizoon/antonizoon.github.io that referenced this issue Jul 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment