1
1
mirror of https://github.com/go-gitea/gitea synced 2024-09-28 07:14:07 +00:00
gitea/templates/repo
Yarden Shoham 6a6dc97b0f
Respect user's locale when rendering the date range in the repo activity page (#21410)
# Description
Previously, to make the date range understood by all, we used the format
"2006-01-02" for the dates as it's locale-generic.

This commit changes the rendering logic. Instead of rendering the date
on the server, we send a formatted computer-readable timestamp. The
client's javascript then renders it according to the user's locale.

This approach is reusable across the codebase, any `<time></time>` tag
with the data-format="date" attribute would get rendered according to
the user's chosen locale.

## Previous View

![image](https://user-images.githubusercontent.com/20454870/195099143-e1c5df86-282a-42f1-898f-a36bb5fe7c2f.png)

## New View

### English

![image](https://user-images.githubusercontent.com/20454870/195099301-5cda4eab-4012-49d5-97e5-b1f9cada9c06.png)

### French

![image](https://user-images.githubusercontent.com/20454870/195099434-ce23e394-8d65-4c4c-8ac8-8b96bc9044f3.png)

### Portuguese

![image](https://user-images.githubusercontent.com/20454870/195099559-9a7aed28-944a-45ec-bedb-64403e3faede.png)

### Italian

![image](https://user-images.githubusercontent.com/20454870/195099661-17758d55-3fe0-4797-879b-d45de0ee8ba3.png)

# References
* #21380 
* #21387
* #21396

Inspiration:

I think either differentiating by class, or probably better by a custom
attribute such as `data-format` or similar, is the best course of
action.

_Originally posted by @delvh in
https://github.com/go-gitea/gitea/issues/21396#issuecomment-1274424788_
      


Resolves #21380

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2022-10-13 00:14:14 +03:00
..
branch
diff Refactor from Vue2 to Vue3 (#20044) 2022-10-01 22:26:38 +08:00
editor
find
graph
issue Fix calls to i18n in templates (#21394) 2022-10-10 15:05:32 +01:00
migrate
projects
pulls Add filetree on left of diff view (#21012) 2022-09-27 13:22:19 +08:00
release Tag list should include draft releases with existing tags (#21263) 2022-10-03 20:05:53 +08:00
settings Fix calls to i18n in templates (#21394) 2022-10-10 15:05:32 +01:00
wiki
activity.tmpl Respect user's locale when rendering the date range in the repo activity page (#21410) 2022-10-13 00:14:14 +03:00
blame.tmpl
branch_dropdown.tmpl Keep path when creating a new branch (#21153) 2022-09-15 21:25:16 +08:00
clone_buttons.tmpl
clone_script.tmpl
commit_page.tmpl Add filetree on left of diff view (#21012) 2022-09-27 13:22:19 +08:00
commit_status.tmpl
commit_statuses.tmpl
commits_list_small.tmpl
commits_list.tmpl
commits_table.tmpl
commits.tmpl
create.tmpl Remove cancel button in repo creation page (#21381) 2022-10-11 22:47:35 +08:00
empty.tmpl
forks.tmpl
graph.tmpl
header.tmpl
home.tmpl Make Clone in VSCode link get updated correctly (#21225) 2022-09-21 19:51:10 +08:00
icon.tmpl
packages.tmpl
search.tmpl Add user/organization code search (#19977) 2022-10-11 00:12:03 +01:00
shabox_badge.tmpl
sub_menu.tmpl
unicode_escape_prompt.tmpl
upload.tmpl
user_cards.tmpl
view_file.tmpl Show .editorconfig errors in frontend (#21088) 2022-09-12 00:16:56 +02:00
view_list.tmpl
watchers.tmpl