Skip to content
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

[Feature request] i18n support #24

Closed
VincentTam opened this issue Aug 7, 2019 · 6 comments

Comments

@VincentTam
Copy link
Collaborator

commented Aug 7, 2019

While I'm adding i18n translation strings, I would like your help, @onweru. Where're the English UI strings located? I can only find two with git grep:

  1. "Designed by"
  2. "Share story"

Are there more English UI strings in the theme? (Not counting those in the user-defined config file) Your answer will help me set up the i18n framework, so that users can upload translations for other languages.

@onweru

This comment has been minimized.

Copy link
Owner

commented Aug 13, 2019

I added a string More From in this commit 6ba83cb

@VincentTam

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 13, 2019

@onweru No, please don't merge #27 for the reasons that I've listed in my recent comment there. This creates difficulties when one creates a custom content type.

(Edited: As @onweru clarified, it's not a merge. Here's the difference: https://github.com/onweru/hugo-swift-theme/compare/4de1506289af2aa36ead5644e7d94c0c2a98902d..6ba83cb288d1675d8e758633a167ee77e4a9ba0d)

In addition, we should encourage contributors to think about i18n in future PRs.

@VincentTam

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 13, 2019

@onweru Lemme add that back later since my project also touches these i18n strings. As a "trailer", here's what gd master --stat on my current branch. (I'm using oh-my-zsh to simplify Git cmds.) You may view the WIP work on my demo testing site on Framagit: https://lstu.fr/hst0 (full link: https://framagit.org/staticman-gitlab-pages/hugo-swift-theme).

 assets/js/index.js                                                                  |  109 +++-
 assets/js/timeago.js                                                                |   54 ++
 assets/scss/_comments.scss                                                          |   54 +-
 assets/scss/_components.scss                                                        |    3 +
 data/comments/4f1f56186d2fece779068cd43c2d5eb2/comment-2019-07-06T23-18-34.268.yml  |    5 +
 data/comments/507bc9792a164d425d567b4bf070f0a1/comment-2019-05-22T00-11-44.295.yml  |    5 +
 data/comments/a3e7063a0e9e0c1d8d6ccd47a4b57e30/comment-2019-07-02T17-18-47.961.yml  |    5 +
 exampleSite/config.toml                                                             |   34 +-
 .../resources/_gen/assets/js/js/index.js_a64a8f41489dfe65eddbff8447bd69ed.content   |  110 +++-
 .../resources/_gen/assets/js/js/timeago.js_017f20a5d0948fc09fa8e1ad65875192.content |   29 +-
 .../resources/_gen/assets/js/js/timeago.js_017f20a5d0948fc09fa8e1ad65875192.json    |    1 +
 .../resources/_gen/assets/scss/main.scss_88f3617a2a6cae9f329774e89e1b9f02.content   | 1238 +++++++++++++++++++++++++++++++++++++++
 .../resources/_gen/assets/scss/main.scss_88f3617a2a6cae9f329774e89e1b9f02.json      |    1 +
 .../_gen/assets/scss/scss/main.scss_65b0252c4a2fb050308e79c52b2c1909.content        |   57 +-
 .../resources/_gen/assets/scss/scss/main.scss_65b0252c4a2fb050308e79c52b2c1909.json |    2 +-
 exampleSite/staticman.yml                                                           |   13 +-
 i18n/en.toml                                                                        |   56 ++
 i18n/fr.toml                                                                        |   56 ++
 i18n/zh-CN.toml                                                                     |   56 ++
 i18n/zh-TW.toml                                                                     |   56 ++
 layouts/_default/single.html                                                        |    3 +-
 layouts/partials/comments-form.html                                                 |   36 +-
 layouts/partials/comments.html                                                      |   58 +-
 staticman.yml                                                                       |   30 +
 24 files changed, 1931 insertions(+), 140 deletions(-)

VincentTam added a commit to VincentTam/hugo-swift-theme that referenced this issue Aug 14, 2019

@VincentTam

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 14, 2019

I added a string More From in this commit 6ba83cb

@onweru When I asked my question in the very first post in this thread, I was actually asking your assistance to find out the hidden English strings not in expected places, like static/css/timeago.js. Once the i18n framework was created in #26, we (as well as future contributor) should use {{ i18n "myString" }} in the template file and insert the corresponding entry in every locale file.

# i18n/en.toml
[myString]
  other = "my string"
# i18n/fr.toml
[myString]
  other = "ma chaîne de caractères"
# i18n/zh-CN.toml
[myString]
  other = "我的字串"
# i18n/zh-TW.toml
[myString]
  other = "my string"

ℹ️ In case of unknown translation (say, 🇹🇼 Traditional Chinese), leave the English UI string. In this case, everyone knows that the translation is missing, and interested users (without any programming knowledge) can volunteer to help by simply modifying the entry value.

Closing this via #26, #36 and #38.

@VincentTam

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 20, 2019

@onweru When I started this issue, I suppose this to be an announcement on the i18n framework that I was working for. Now, it has been set up, so it should be closed. I don't intend this to be on/off button. To signify a translation request, commenting in the relevant sections of code suffices. If you want to group issues/PRs related to i18n, you may consider adding a new label for GitHub issues/PRs, instead of having us to scroll down to the bottom in this issue.

@onweru

This comment has been minimized.

Copy link
Owner

commented Aug 20, 2019

To signify a translation request, commenting in the relevant sections of code suffices. If you want to group issues/PRs related to i18n, you may consider adding a new label for GitHub issues/PRs, instead of having us to scroll down to the bottom in this issue.

Makes sense 👍

@onweru onweru closed this Aug 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.