GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — android-code.github.io/_includes/date-translated.html at master · android-code/android-code.github.io

Expand file tree

/

date-translated.html

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
57 lines (44 loc) · 2.56 KB
/

date-translated.html

Copy path

File metadata and controls

57 lines (44 loc) · 2.56 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{% comment %}
This include allows to translate the days and months in the date by using strings in _data/locales/[lang].yml
This include can be called with three parameters:
- include.date: the date to be processed
- include.format: the date format. (If empty a default format will be used)
- include.lang: lang to use for translation.
{% endcomment %}
{% comment %}
If the parameter date format is empty the default format set in _config.yml is used.
If there is no default in _config, "%b %-d, %Y" is used.
{% endcomment %}
{% assign date_format_to_be_translated = include.format | default: site.date_format | default: "%b %-d, %Y" %}
{% comment %}
Init to have the indice of the day in the week (num_day) and the indice of the month in the year (num_mont)
Init the lang parameter depending if it's set in the include call, in the page or in the site settings
{% endcomment %}
{% assign num_day = include.date | date: "%w" | plus: 0 %}
{% assign num_month = include.date | date: "%-m" | plus: -1 %}
{% assign lang = include.lang | default: page.lang | default: site.lang %}
{% comment %}
Use translated abbreviated weekday if "%a" is used in the format and the translation is available in _data/locales/[lang].yml
{% endcomment %}
{% if site.data.locales[lang].abbreviated_weekday[num_day] %}
{% assign date_format_to_be_translated = date_format_to_be_translated | replace: "%a", site.data.locales[lang].abbreviated_weekday[num_day] %}
{% endif %}
{% comment %}
Use translated full weekday if "%A" is used in the format and the translation is available in _data/locales/[lang].yml
{% endcomment %}
{% if site.data.locales[lang].full_weekday[num_day] %}
{% assign date_format_to_be_translated = date_format_to_be_translated | replace: "%A", site.data.locales[lang].full_weekday[num_day] %}
{% endif %}
{% comment %}
Use translated abbreviated month if "%b" is used in the format and the translation is available in _data/locales/[lang].yml
{% endcomment %}
{% if site.data.locales[lang].abbreviated_month[num_month] %}
{% assign date_format_to_be_translated = date_format_to_be_translated | replace: "%b", site.data.locales[lang].abbreviated_month[num_month] %}
{% endif %}
{% comment %}
Use translated abbreviated weekday if "%B" is used in the format and the translation is available in _data/locales/[lang].yml
{% endcomment %}
{% if site.data.locales[lang].full_month[num_month] %}
{% assign date_format_to_be_translated = date_format_to_be_translated | replace: "%B", site.data.locales[lang].full_month[num_month] %}
{% endif %}
{{ include.date | date: date_format_to_be_translated }}
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.