mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 06:03:51 +03:00
[I18N] Injected updated time in translation string (#3837)
Hello, It is more idiomatic to put the date/time before the action in Mandarin (in this context). To achieve this, instead of having the time following the string that's passed to the translating function, I added it as a parameter so that one can reference it and reorder the sentence for better translatability. Only Traditional Chinese has been changed at the time of opening this PR, as this is more of a proof of concept and I would like to have feedbacks on whether this is a good solution or is there a better alternative. Thank you and have a nice day :) Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3837 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Léana 江 <leana.jiang+git@icloud.com> Co-committed-by: Léana 江 <leana.jiang+git@icloud.com>
This commit is contained in:
parent
bcd2e64a93
commit
3561cc710b
33 changed files with 104 additions and 33 deletions
|
@ -503,7 +503,7 @@ settings.delete_org_desc = هذه المنظمة ستحذف إلى الأبد،
|
|||
create_org = أنشئ منظمة
|
||||
teams.add_all_repos_desc = سيضيف هذا كل مستودعات المنظمة إلى الفريق.
|
||||
settings.labels_desc = أضف التصنيفات القابلة للاستخدام في المسائل التابعة <strong>لكل مستودعات</strong> هذه المنظمة.
|
||||
repo_updated = حُدِّث
|
||||
repo_updated = حُدِّث %s
|
||||
org_desc = الوصف
|
||||
org_name_helper = ينبغي أن تكون أسماء المنظمات قصيرة وسهلة التذكر.
|
||||
team_permission_desc = الأذونات
|
||||
|
|
|
@ -1210,7 +1210,7 @@ settings.delete_prompt = Организацията ще бъде премахн
|
|||
settings.labels_desc = Добавете етикети, които могат да се използват за задачи за <strong>всички хранилища</strong> в тази организация.
|
||||
teams.none_access = Без достъп
|
||||
teams.members.none = Няма членове в този екип.
|
||||
repo_updated = Обновено
|
||||
repo_updated = Обновено %s
|
||||
teams.delete_team_success = Екипът е изтрит.
|
||||
teams.search_repo_placeholder = Потърсете хранилище…
|
||||
teams.delete_team_title = Изтриване на екипа
|
||||
|
|
|
@ -2772,7 +2772,7 @@ org_name_holder=Název organizace
|
|||
org_full_name_holder=Celý název organizace
|
||||
org_name_helper=Jména organizací by měla být krátká a zapamatovatelná.
|
||||
create_org=Vytvořit organizaci
|
||||
repo_updated=Upraveno
|
||||
repo_updated=Upraveno %s
|
||||
members=Členové
|
||||
teams=Týmy
|
||||
code=Kód
|
||||
|
|
|
@ -2749,7 +2749,7 @@ org_name_holder=Name der Organisation
|
|||
org_full_name_holder=Vollständiger Name der Organisation
|
||||
org_name_helper=Organisationsnamen sollten kurz und einprägsam sein.
|
||||
create_org=Organisation erstellen
|
||||
repo_updated=Aktualisiert
|
||||
repo_updated=Aktualisiert %s
|
||||
members=Mitglieder
|
||||
teams=Teams
|
||||
code=Quelltext
|
||||
|
|
|
@ -2737,7 +2737,7 @@ org_name_holder=Όνομα οργανισμού
|
|||
org_full_name_holder=Πλήρες όνομα οργανισμού
|
||||
org_name_helper=Τα ονόματα οργανισμών θα πρέπει να είναι σύντομα και εύκολα στην απομνημόνευση.
|
||||
create_org=Δημιουργία οργανισμού
|
||||
repo_updated=Ενημερώθηκε
|
||||
repo_updated=Ενημερώθηκε %s
|
||||
members=Μέλη
|
||||
teams=Ομάδες
|
||||
code=Κώδικας
|
||||
|
|
|
@ -2732,7 +2732,7 @@ org_full_name_holder = Organization full name
|
|||
org_name_helper = Organization names should be short and memorable.
|
||||
create_org = Create organization
|
||||
open_dashboard = Open dashboard
|
||||
repo_updated = Updated
|
||||
repo_updated = Updated %s
|
||||
members = Members
|
||||
teams = Teams
|
||||
code = Code
|
||||
|
|
|
@ -2623,7 +2623,7 @@ org_name_holder=Nombre de la organización
|
|||
org_full_name_holder=Nombre completo de la organización
|
||||
org_name_helper=Los nombres de organización deben ser cortos y destacados.
|
||||
create_org=Crear Organización
|
||||
repo_updated=Actualizado
|
||||
repo_updated=Actualizado %s
|
||||
members=Miembros
|
||||
teams=Equipos
|
||||
code=Código
|
||||
|
|
|
@ -1981,7 +1981,7 @@ org_name_holder=نام سازمان
|
|||
org_full_name_holder=نام کامل سازمان
|
||||
org_name_helper=نام سازمان باید کوتاه و قابل حفظ کردن باشد.
|
||||
create_org=ایجاد سازمان
|
||||
repo_updated=به روز رسانی شده
|
||||
repo_updated=به روز رسانی شده %s
|
||||
members=اعضاء
|
||||
teams=تیمها
|
||||
lower_members=اعضا
|
||||
|
|
|
@ -1352,7 +1352,7 @@ org_name_holder=Organisaatio
|
|||
org_full_name_holder=Organisaation täydellinen nimi
|
||||
org_name_helper=Organisaation nimen tulisi olla lyhyt ja mieleenpainuva.
|
||||
create_org=Luo organisaatio
|
||||
repo_updated=Päivitetty
|
||||
repo_updated=Päivitetty %s
|
||||
members=Jäsenet
|
||||
teams=Tiimit
|
||||
lower_members=jäsenet
|
||||
|
|
|
@ -1827,7 +1827,7 @@ config.ssh_keygen_path = Path ng keygen ("ssh-keygen")
|
|||
config.ssh_key_test_path = Path ng key test
|
||||
|
||||
[org]
|
||||
repo_updated = Binago
|
||||
repo_updated = Binago %s
|
||||
team_access_desc = Access ng repositoryo
|
||||
team_permission_desc = Pahintulot
|
||||
org_desc = Deskripsyon
|
||||
|
|
|
@ -2769,7 +2769,7 @@ org_name_holder=Nom de l'organisation
|
|||
org_full_name_holder=Nom complet de l'organisation
|
||||
org_name_helper=Le nom de l'organisation doit être court et mémorable.
|
||||
create_org=Créer une organisation
|
||||
repo_updated=Actualisé
|
||||
repo_updated=Actualisé %s
|
||||
members=Membres
|
||||
teams=Équipes
|
||||
code=Code
|
||||
|
|
|
@ -1179,7 +1179,7 @@ org_name_holder=Szervezet neve
|
|||
org_full_name_holder=Szervezet teljes neve
|
||||
org_name_helper=A szervezetek nevének rövidnek és megjegyezhetőnek kell lennie.
|
||||
create_org=Szervezet létrehozása
|
||||
repo_updated=Frissítve
|
||||
repo_updated=Frissítve %s
|
||||
members=Tagok
|
||||
teams=Csoportok
|
||||
lower_members=tagok
|
||||
|
|
|
@ -963,7 +963,7 @@ branch.deleted_by=Dihapus oleh %s
|
|||
org_name_holder=Nama Organisasi
|
||||
org_full_name_holder=Organisasi Nama Lengkap
|
||||
create_org=Buat Organisasi
|
||||
repo_updated=Diperbarui
|
||||
repo_updated=Diperbarui %s
|
||||
members=Anggota
|
||||
teams=Tim
|
||||
lower_members=anggota
|
||||
|
|
|
@ -1120,7 +1120,7 @@ topic.done=Í lagi
|
|||
[graphs]
|
||||
|
||||
[org]
|
||||
repo_updated=Uppfært
|
||||
repo_updated=Uppfært %s
|
||||
members=Meðlimar
|
||||
teams=Lið
|
||||
lower_members=meðlimar
|
||||
|
|
|
@ -2748,7 +2748,7 @@ org_name_holder=Nome dell'organizzazione
|
|||
org_full_name_holder=Nome completo dell'organizzazione
|
||||
org_name_helper=I nomi delle organizzazioni devono essere brevi e semplici da ricordare.
|
||||
create_org=Crea organizzazione
|
||||
repo_updated=Aggiornato
|
||||
repo_updated=Aggiornato %s
|
||||
members=Membri
|
||||
teams=Team
|
||||
lower_members=membri
|
||||
|
|
|
@ -2745,7 +2745,7 @@ org_name_holder=組織名
|
|||
org_full_name_holder=組織のフルネーム
|
||||
org_name_helper=組織名は短く覚えやすいものにしましょう。
|
||||
create_org=組織を作成
|
||||
repo_updated=最終更新
|
||||
repo_updated=最終更新 %s
|
||||
members=メンバー
|
||||
teams=チーム
|
||||
code=コード
|
||||
|
|
|
@ -1283,7 +1283,7 @@ pulls.blocked_by_official_review_requests = 이 풀 리퀘스트는 공식 검
|
|||
org_name_holder=조직 이름
|
||||
org_full_name_holder=조직 전체 이름
|
||||
create_org=새로운 조직
|
||||
repo_updated=업데이트됨
|
||||
repo_updated=업데이트됨 %s
|
||||
members=멤버
|
||||
teams=팀
|
||||
lower_members=회원
|
||||
|
|
|
@ -2581,7 +2581,7 @@ org_name_holder=Organizācijas nosaukums
|
|||
org_full_name_holder=Organizācijas pilnais nosaukums
|
||||
org_name_helper=Organizāciju nosaukumiem vēlams būt īsiem un tādiem, ko viegli atcerēties.
|
||||
create_org=Izveidot organizāciju
|
||||
repo_updated=Atjaunināts
|
||||
repo_updated=Atjaunināts %s
|
||||
members=Dalībnieki
|
||||
teams=Komandas
|
||||
code=Kods
|
||||
|
|
|
@ -2731,7 +2731,7 @@ org_name_holder=Organisatienaam
|
|||
org_full_name_holder=Volledige naam organisatie
|
||||
org_name_helper=Organisatienamen horen kort en memorabel zijn.
|
||||
create_org=Nieuwe organisatie aanmaken
|
||||
repo_updated=Geupdate
|
||||
repo_updated=Geupdate %s
|
||||
members=Leden
|
||||
teams=Teams
|
||||
lower_members=leden
|
||||
|
|
|
@ -2033,7 +2033,7 @@ org_name_holder=Nazwa organizacji
|
|||
org_full_name_holder=Pełna nazwa organizacji
|
||||
org_name_helper=Nazwa organizacji powinna być krótka i łatwa do zapamiętania.
|
||||
create_org=Utwórz organizację
|
||||
repo_updated=Zaktualizowano
|
||||
repo_updated=Zaktualizowano %s
|
||||
members=Członkowie
|
||||
teams=Zespoły
|
||||
lower_members=członkowie
|
||||
|
|
|
@ -2610,7 +2610,7 @@ org_name_holder=Nome da organização
|
|||
org_full_name_holder=Nome completo da organização
|
||||
org_name_helper=Nomes de organização devem ser curtos e memoráveis.
|
||||
create_org=Criar organização
|
||||
repo_updated=Atualizado
|
||||
repo_updated=Atualizado %s
|
||||
members=Membros
|
||||
teams=Equipes
|
||||
code=Código
|
||||
|
|
|
@ -2750,7 +2750,7 @@ org_name_holder=Nome da organização
|
|||
org_full_name_holder=Nome completo da organização
|
||||
org_name_helper=Nomes das organizações devem ser curtos e memoráveis.
|
||||
create_org=Criar organização
|
||||
repo_updated=Modificado
|
||||
repo_updated=Modificado %s
|
||||
members=Membros
|
||||
teams=Equipas
|
||||
code=Código
|
||||
|
|
|
@ -2749,7 +2749,7 @@ org_name_holder=Название организации
|
|||
org_full_name_holder=Полное название
|
||||
org_name_helper=Лучшие названия организаций коротки и запоминаемы.
|
||||
create_org=Создать организацию
|
||||
repo_updated=Обновлено
|
||||
repo_updated=Обновлено %s
|
||||
members=Участники
|
||||
teams=Команды
|
||||
code=Код
|
||||
|
|
|
@ -1921,7 +1921,7 @@ org_name_holder=සංවිධානයේ නම
|
|||
org_full_name_holder=සංවිධානයේ සම්පූර්ණ නම
|
||||
org_name_helper=සංවිධාන නම් කෙටි හා අමතක නොවන විය යුතුය.
|
||||
create_org=සංවිධානය සාදන්න
|
||||
repo_updated=යාවත්කාල කෙරිණි
|
||||
repo_updated=යාවත්කාල කෙරිණි %s
|
||||
members=සාමාජිකයින්
|
||||
teams=කණ්ඩායම්
|
||||
lower_members=සාමාජිකයින්
|
||||
|
|
|
@ -1546,7 +1546,7 @@ org_name_holder=Organisationsnamn
|
|||
org_full_name_holder=Organisationens Fullständiga Namn
|
||||
org_name_helper=Organisationsnamn bör vara korta och enkla att komma ihåg.
|
||||
create_org=Skapa organisation
|
||||
repo_updated=Uppdaterad
|
||||
repo_updated=Uppdaterad %s
|
||||
members=Medlemmar
|
||||
teams=Grupper
|
||||
lower_members=medlemmar
|
||||
|
|
|
@ -2591,7 +2591,7 @@ org_name_holder=Organizasyon Adı
|
|||
org_full_name_holder=Organizasyon Tam Adı
|
||||
org_name_helper=Organizasyon adları kısa ve hatırlanabilir olmalıdır.
|
||||
create_org=Organizasyon Oluştur
|
||||
repo_updated=Güncellendi
|
||||
repo_updated=Güncellendi %s
|
||||
members=Üyeler
|
||||
teams=Takımlar
|
||||
code=Kod
|
||||
|
|
|
@ -2078,7 +2078,7 @@ org_name_holder=Назва організації
|
|||
org_full_name_holder=Повна назва організації
|
||||
org_name_helper=Назва організації має бути простою та зрозумілою.
|
||||
create_org=Створити організацію
|
||||
repo_updated=Оновлено
|
||||
repo_updated=Оновлено %s
|
||||
members=Учасники
|
||||
teams=Команди
|
||||
lower_members=учасники
|
||||
|
|
|
@ -2767,7 +2767,7 @@ org_name_holder=组织名称
|
|||
org_full_name_holder=组织全名
|
||||
org_name_helper=组织名字应该简单明了。
|
||||
create_org=创建组织
|
||||
repo_updated=最后更新于
|
||||
repo_updated=于 %s 更新
|
||||
members=成员
|
||||
teams=团队
|
||||
code=代码
|
||||
|
|
|
@ -676,7 +676,7 @@ release.downloads=下載附件
|
|||
org_name_holder=組織名稱
|
||||
org_full_name_holder=組織全名
|
||||
create_org=建立組織
|
||||
repo_updated=最後更新於
|
||||
repo_updated=最後更新於 %s
|
||||
members=成員數
|
||||
teams=組織團隊
|
||||
lower_members=名成員
|
||||
|
|
|
@ -2511,7 +2511,7 @@ org_name_holder=組織名稱
|
|||
org_full_name_holder=組織全名
|
||||
org_name_helper=組織名稱應該要簡短且方便記憶
|
||||
create_org=建立組織
|
||||
repo_updated=更新於
|
||||
repo_updated=於 %s 更新
|
||||
members=成員
|
||||
teams=團隊
|
||||
code=程式碼
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="flex-item-body">{{ctx.Locale.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix ctx.Locale}}</div>
|
||||
<div class="flex-item-body">{{ctx.Locale.Tr "org.repo_updated" (TimeSinceUnix .UpdatedUnix ctx.Locale)}}</div>
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DefaultBranchBranch.DBBranch.Name}}">{{svg "octicon-copy" 14}}</button>
|
||||
{{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DefaultBranchBranch.DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DefaultBranchBranch.DBBranch.CommitID)}}
|
||||
</div>
|
||||
<p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DefaultBranchBranch.DBBranch.CommitMessage (.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated"}} {{TimeSince .DefaultBranchBranch.DBBranch.CommitTime.AsTime ctx.Locale}}{{if .DefaultBranchBranch.DBBranch.Pusher}} {{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p>
|
||||
<p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DefaultBranchBranch.DBBranch.CommitMessage (.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated" (TimeSince .DefaultBranchBranch.DBBranch.CommitTime.AsTime ctx.Locale)}} {{if .DefaultBranchBranch.DBBranch.Pusher}} {{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p>
|
||||
</td>
|
||||
<td class="right aligned middle aligned overflow-visible">
|
||||
{{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}}
|
||||
|
@ -98,7 +98,7 @@
|
|||
<button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}">{{svg "octicon-copy" 14}}</button>
|
||||
{{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DBBranch.CommitID)}}
|
||||
</div>
|
||||
<p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .DBBranch.CommitID}}">{{ShortSha .DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DBBranch.CommitMessage ($.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated"}} {{TimeSince .DBBranch.CommitTime.AsTime ctx.Locale}}{{if .DBBranch.Pusher}} {{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}} {{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}</p>
|
||||
<p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .DBBranch.CommitID}}">{{ShortSha .DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DBBranch.CommitMessage ($.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated" (TimeSince .DBBranch.CommitTime.AsTime ctx.Locale)}} {{if .DBBranch.Pusher}} {{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}} {{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}</p>
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="two wide ui">
|
||||
|
|
71
tests/integration/last_updated_time_test.go
Normal file
71
tests/integration/last_updated_time_test.go
Normal file
|
@ -0,0 +1,71 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestRepoLastUpdatedTime(t *testing.T) {
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
user := "user2"
|
||||
session := loginUser(t, user)
|
||||
|
||||
req := NewRequest(t, "GET", path.Join("explore", "repos"))
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
doc := NewHTMLParser(t, resp.Body)
|
||||
node := doc.doc.Find(".flex-item-body").First()
|
||||
|
||||
{
|
||||
buf := ""
|
||||
findTextNonNested(t, node, &buf)
|
||||
assert.Equal(t, "Updated", strings.TrimSpace(buf))
|
||||
}
|
||||
|
||||
// Relative time should be present as a descendent
|
||||
{
|
||||
relativeTime := node.Find("relative-time").Text()
|
||||
assert.Equal(t, true, strings.HasPrefix(relativeTime, "19")) // ~1970, might underflow with timezone
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestBranchLastUpdatedTime(t *testing.T) {
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
user := "user2"
|
||||
repo := "repo1"
|
||||
session := loginUser(t, user)
|
||||
|
||||
req := NewRequest(t, "GET", path.Join(user, repo, "branches"))
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
doc := NewHTMLParser(t, resp.Body)
|
||||
node := doc.doc.Find("p:has(span.commit-message)")
|
||||
|
||||
{
|
||||
buf := ""
|
||||
findTextNonNested(t, node, &buf)
|
||||
assert.Equal(t, true, strings.Contains(buf, "Updated"))
|
||||
}
|
||||
|
||||
{
|
||||
relativeTime := node.Find("relative-time").Text()
|
||||
assert.Equal(t, true, strings.HasPrefix(relativeTime, "2017"))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Find all text that are direct descendents
|
||||
func findTextNonNested(t *testing.T, n *goquery.Selection, buf *string) {
|
||||
t.Helper()
|
||||
|
||||
n.Contents().Each(func(i int, s *goquery.Selection) {
|
||||
if goquery.NodeName(s) == "#text" {
|
||||
*buf += s.Text()
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue