From 8f318976ff6b9d44c48730e50bfa0f4fe0a1ae0d Mon Sep 17 00:00:00 2001 From: Matheus Rocha Vieira Date: Thu, 26 Apr 2018 23:11:55 -0300 Subject: [PATCH 1/5] i18n --- _config.yml | 7 +++++ _data/fields.yml | 3 +++ _data/locale/en-US.yml | 28 ++++++++++++++++++++ _includes/breadcrumbs.html | 4 +-- _includes/footer.html | 9 +++---- _includes/header.html | 2 +- _includes/license-overview.html | 2 +- _includes/sidebar.html | 12 ++++----- assets/js/locale.js | 45 +++++++++++++++++++++++++++++++++ 9 files changed, 97 insertions(+), 15 deletions(-) create mode 100644 _data/locale/en-US.yml create mode 100644 assets/js/locale.js diff --git a/_config.yml b/_config.yml index 004f14b67..fba17c388 100644 --- a/_config.yml +++ b/_config.yml @@ -5,6 +5,13 @@ relative_permalinks: false markdown: kramdown url: "https://choosealicense.com" +# See: docs/translations.md +locale: en-US +translations: + en-US: + name: English (US) + url: https://choosealicense.com + collections: licenses: output: true diff --git a/_data/fields.yml b/_data/fields.yml index 4e55d421f..d3d93add0 100644 --- a/_data/fields.yml +++ b/_data/fields.yml @@ -4,6 +4,9 @@ # variables from the repository. These can be used to create accurate copyright # notices. The available variables are: +- locale: + type: String + - name: fullname description: The full name or username of the repository owner diff --git a/_data/locale/en-US.yml b/_data/locale/en-US.yml new file mode 100644 index 000000000..3259a00c0 --- /dev/null +++ b/_data/locale/en-US.yml @@ -0,0 +1,28 @@ +breadcrumb: + home: Home + licenses: Licenses + +sidebar: + clipboard: Copy license text to clipboard + how_to_apply: How to apply this license + note: Note + optional: Optional + add: Add + or: or + disallow: to disallow future versions + package: to your project's package description, if applicable + exempli_gratia: e.g. + and: and + ensure: This will ensure the license is displayed in package directories. + source: Source + projects_with_license: Who's using this license? + +license_overview: + view_full: View full + +footer: + about: About + table_of_contents: Table of Contents + licenses: The content of this site is licensed under the + Creative Commons Attribution 3.0 Unported License + with_love: Curated with <3 by GitHub, Inc. and You! diff --git a/_includes/breadcrumbs.html b/_includes/breadcrumbs.html index 1cc6bdc78..e89c6e8e9 100644 --- a/_includes/breadcrumbs.html +++ b/_includes/breadcrumbs.html @@ -2,9 +2,9 @@
  1. {% if page.layout == "license" %} - Home / Licenses + {{ site.data.locale[site.locale].breadcrumb.home }} / {{ site.data.locale[site.locale].breadcrumb.licenses }} {% else %} - Home + {{ site.data.locale[site.locale].breadcrumb.home }} {% endif %}
diff --git a/_includes/footer.html b/_includes/footer.html index 219b3819a..0870b4c6e 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -1,14 +1,13 @@ diff --git a/_includes/header.html b/_includes/header.html index 0d6859595..f31c4a2d9 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -1,5 +1,5 @@ - + diff --git a/_includes/license-overview.html b/_includes/license-overview.html index 320c4142a..a1f255bfc 100644 --- a/_includes/license-overview.html +++ b/_includes/license-overview.html @@ -43,7 +43,7 @@

{% endfor %} -

View full {{ license.title }} »

+

{{ site.data.locale[site.locale].license_overview.view_full }} {{ license.title }} »

{% endfor %} diff --git a/_includes/sidebar.html b/_includes/sidebar.html index a1218b5e9..4c0cb6333 100644 --- a/_includes/sidebar.html +++ b/_includes/sidebar.html @@ -1,34 +1,34 @@