mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Refactor i18n
to locale
(#20153)
* Refactor `i18n` to `locale` - Currently we're using the `i18n` variable naming for the `locale` struct. This contains locale's specific information and cannot be used for general i18n purpose, therefore refactoring it to `locale` makes more sense. - Ref: https://github.com/go-gitea/gitea/pull/20096#discussion_r906699200 * Update routers/install/install.go
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
<div class="ui container">
|
||||
{{template "base/alert" .}}
|
||||
<div class="ui header">
|
||||
{{.i18n.Tr "repo.wiki.new_page"}}
|
||||
{{.locale.Tr "repo.wiki.new_page"}}
|
||||
{{if .PageIsWikiEdit}}
|
||||
<div class="ui right">
|
||||
<a class="ui green small button" href="{{.RepoLink}}/wiki?action=_new">{{.i18n.Tr "repo.wiki.new_page_button"}}</a>
|
||||
<a class="ui green small button" href="{{.RepoLink}}/wiki?action=_new">{{.locale.Tr "repo.wiki.new_page_button"}}</a>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
@@ -17,23 +17,23 @@
|
||||
<input name="title" value="{{.title}}" autofocus required>
|
||||
</div>
|
||||
<div class="help">
|
||||
{{.i18n.Tr "repo.wiki.page_name_desc"}}
|
||||
{{.locale.Tr "repo.wiki.page_name_desc"}}
|
||||
</div>
|
||||
<div class="ui top attached tabular menu previewtabs" data-write="write" data-preview="preview">
|
||||
<a class="active item" data-tab="write">{{.i18n.Tr "write"}}</a>
|
||||
<a class="item" data-tab="preview" data-url="{{$.Repository.HTMLURL}}/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a>
|
||||
<a class="active item" data-tab="write">{{.locale.Tr "write"}}</a>
|
||||
<a class="item" data-tab="preview" data-url="{{$.Repository.HTMLURL}}/markdown" data-context="{{$.RepoLink}}">{{$.locale.Tr "preview"}}</a>
|
||||
</div>
|
||||
<div class="field content" data-loading="{{.i18n.Tr "loading"}}">
|
||||
<div class="field content" data-loading="{{.locale.Tr "loading"}}">
|
||||
<div class="ui bottom active tab" data-tab="write">
|
||||
<textarea class="js-quick-submit" id="edit_area" name="content" data-id="wiki-{{.title}}" data-url="{{.Repository.HTMLURL}}/markdown" data-context="{{.RepoLink}}">{{if .PageIsWikiEdit}}{{.content}}{{else}}{{.i18n.Tr "repo.wiki.welcome"}}{{end}}</textarea>
|
||||
<textarea class="js-quick-submit" id="edit_area" name="content" data-id="wiki-{{.title}}" data-url="{{.Repository.HTMLURL}}/markdown" data-context="{{.RepoLink}}">{{if .PageIsWikiEdit}}{{.content}}{{else}}{{.locale.Tr "repo.wiki.welcome"}}{{end}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<input name="message" placeholder="{{.i18n.Tr "repo.wiki.default_commit_message"}}">
|
||||
<input name="message" placeholder="{{.locale.Tr "repo.wiki.default_commit_message"}}">
|
||||
</div>
|
||||
<div class="text right">
|
||||
<button class="ui green button">
|
||||
{{.i18n.Tr "repo.wiki.save_page"}}
|
||||
{{.locale.Tr "repo.wiki.save_page"}}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
@@ -4,11 +4,11 @@
|
||||
<div class="ui container">
|
||||
<h2 class="ui header df ac sb">
|
||||
<div>
|
||||
{{.i18n.Tr "repo.wiki.pages"}}
|
||||
{{.locale.Tr "repo.wiki.pages"}}
|
||||
</div>
|
||||
<div>
|
||||
{{if and .CanWriteWiki (not .IsRepositoryMirror)}}
|
||||
<a class="ui green small button" href="{{.RepoLink}}/wiki?action=_new">{{.i18n.Tr "repo.wiki.new_page_button"}}</a>
|
||||
<a class="ui green small button" href="{{.RepoLink}}/wiki?action=_new">{{.locale.Tr "repo.wiki.new_page_button"}}</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</h2>
|
||||
@@ -20,8 +20,8 @@
|
||||
{{svg "octicon-file"}}
|
||||
<a href="{{$.RepoLink}}/wiki/{{.SubURL}}">{{.Name}}</a>
|
||||
</td>
|
||||
{{$timeSince := TimeSinceUnix .UpdatedUnix $.i18n}}
|
||||
<td class="text right grey">{{$.i18n.Tr "repo.wiki.last_updated" $timeSince | Safe}}</td>
|
||||
{{$timeSince := TimeSinceUnix .UpdatedUnix $.locale}}
|
||||
<td class="text right grey">{{$.locale.Tr "repo.wiki.last_updated" $timeSince | Safe}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
|
@@ -10,20 +10,20 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui header eight wide column">
|
||||
<a class="file-revisions-btn ui basic button" title="{{.i18n.Tr "repo.wiki.back_to_wiki"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}" ><span>{{.revision}}</span> {{svg "octicon-home"}}</a>
|
||||
<a class="file-revisions-btn ui basic button" title="{{.locale.Tr "repo.wiki.back_to_wiki"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}" ><span>{{.revision}}</span> {{svg "octicon-home"}}</a>
|
||||
{{$title}}
|
||||
<div class="ui sub header word-break">
|
||||
{{$timeSince := TimeSince .Author.When $.i18n}}
|
||||
{{.i18n.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince | Safe}}
|
||||
{{$timeSince := TimeSince .Author.When $.locale}}
|
||||
{{.locale.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince | Safe}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2 class="ui top header">{{.i18n.Tr "repo.wiki.wiki_page_revisions"}}</h2>
|
||||
<h2 class="ui top header">{{.locale.Tr "repo.wiki.wiki_page_revisions"}}</h2>
|
||||
<div class="ui" style="margin-top: 1rem;">
|
||||
<h4 class="ui top attached header">
|
||||
<div class="ui stackable grid">
|
||||
<div class="sixteen wide column">
|
||||
{{.CommitCount}} {{.i18n.Tr "repo.commits.commits"}}
|
||||
{{.CommitCount}} {{.locale.Tr "repo.commits.commits"}}
|
||||
</div>
|
||||
</div>
|
||||
</h4>
|
||||
|
@@ -4,10 +4,10 @@
|
||||
<div class="ui container">
|
||||
<div class="ui center segment">
|
||||
{{svg "octicon-book" 32}}
|
||||
<h2>{{.i18n.Tr "repo.wiki.welcome"}}</h2>
|
||||
<p>{{.i18n.Tr "repo.wiki.welcome_desc"}}</p>
|
||||
<h2>{{.locale.Tr "repo.wiki.welcome"}}</h2>
|
||||
<p>{{.locale.Tr "repo.wiki.welcome_desc"}}</p>
|
||||
{{if and .CanWriteWiki (not .Repository.IsMirror)}}
|
||||
<a class="ui green button" href="{{.RepoLink}}/wiki?action=_new">{{.i18n.Tr "repo.wiki.create_first_page"}}</a>
|
||||
<a class="ui green button" href="{{.RepoLink}}/wiki?action=_new">{{.locale.Tr "repo.wiki.create_first_page"}}</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -6,10 +6,10 @@
|
||||
<div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins no-vertical-tabs">
|
||||
<div class="fitted item">
|
||||
<div class="choose page">
|
||||
<div class="ui floating filter dropdown" data-no-results="{{.i18n.Tr "repo.pulls.no_results"}}">
|
||||
<div class="ui floating filter dropdown" data-no-results="{{.locale.Tr "repo.pulls.no_results"}}">
|
||||
<div class="ui basic small button">
|
||||
<span class="text">
|
||||
{{.i18n.Tr "repo.wiki.page"}}:
|
||||
{{.locale.Tr "repo.wiki.page"}}:
|
||||
<strong>{{$title}}</strong>
|
||||
</span>
|
||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||
@@ -17,7 +17,7 @@
|
||||
<div class="menu">
|
||||
<div class="ui icon search input">
|
||||
<i class="icon df ac jc m-0">{{svg "octicon-filter" 16}}</i>
|
||||
<input name="search" placeholder="{{.i18n.Tr "repo.wiki.filter_page"}}...">
|
||||
<input name="search" placeholder="{{.locale.Tr "repo.wiki.filter_page"}}...">
|
||||
</div>
|
||||
<div class="scrolling menu">
|
||||
{{range .Pages}}
|
||||
@@ -37,23 +37,23 @@
|
||||
<div class="ui dividing header">
|
||||
<div class="ui stackable grid">
|
||||
<div class="eight wide column">
|
||||
<a class="file-revisions-btn ui basic button" title="{{.i18n.Tr "repo.wiki.file_revision"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}?action=_revision" ><span>{{.CommitCount}}</span> {{svg "octicon-history"}}</a>
|
||||
<a class="file-revisions-btn ui basic button" title="{{.locale.Tr "repo.wiki.file_revision"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}?action=_revision" ><span>{{.CommitCount}}</span> {{svg "octicon-history"}}</a>
|
||||
{{$title}}
|
||||
<div class="ui sub header">
|
||||
{{$timeSince := TimeSince .Author.When $.i18n}}
|
||||
{{.i18n.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince | Safe}}
|
||||
{{$timeSince := TimeSince .Author.When $.locale}}
|
||||
{{.locale.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince | Safe}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="eight wide right aligned column">
|
||||
{{if .EscapeStatus.Escaped}}
|
||||
<a class="ui small button unescape-button" style="display: none;">{{.i18n.Tr "repo.unescape_control_characters"}}</a>
|
||||
<a class="ui small button escape-button">{{.i18n.Tr "repo.escape_control_characters"}}</a>
|
||||
<a class="ui small button unescape-button" style="display: none;">{{.locale.Tr "repo.unescape_control_characters"}}</a>
|
||||
<a class="ui small button escape-button">{{.locale.Tr "repo.escape_control_characters"}}</a>
|
||||
{{end}}
|
||||
{{if and .CanWriteWiki (not .Repository.IsMirror)}}
|
||||
<div class="ui right">
|
||||
<a class="ui small button" href="{{.RepoLink}}/wiki/{{.PageURL}}?action=_edit">{{.i18n.Tr "repo.wiki.edit_page_button"}}</a>
|
||||
<a class="ui green small button" href="{{.RepoLink}}/wiki?action=_new">{{.i18n.Tr "repo.wiki.new_page_button"}}</a>
|
||||
<a class="ui red small button delete-button" href="" data-url="{{.RepoLink}}/wiki/{{.PageURL}}?action=_delete" data-id="{{.PageURL}}">{{.i18n.Tr "repo.wiki.delete_page_button"}}</a>
|
||||
<a class="ui small button" href="{{.RepoLink}}/wiki/{{.PageURL}}?action=_edit">{{.locale.Tr "repo.wiki.edit_page_button"}}</a>
|
||||
<a class="ui green small button" href="{{.RepoLink}}/wiki?action=_new">{{.locale.Tr "repo.wiki.new_page_button"}}</a>
|
||||
<a class="ui red small button delete-button" href="" data-url="{{.RepoLink}}/wiki/{{.PageURL}}?action=_delete" data-id="{{.PageURL}}">{{.locale.Tr "repo.wiki.delete_page_button"}}</a>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
@@ -75,7 +75,7 @@
|
||||
<div class="ui segment wiki-content-toc">
|
||||
<details open>
|
||||
<summary>
|
||||
<div class="ui header">{{.i18n.Tr "toc"}}</div>
|
||||
<div class="ui header">{{.locale.Tr "toc"}}</div>
|
||||
</summary>
|
||||
{{$level := 0}}
|
||||
{{range .toc}}
|
||||
@@ -91,7 +91,7 @@
|
||||
{{if .sidebarPresent}}
|
||||
<div class="ui segment wiki-content-sidebar">
|
||||
{{if and .CanWriteWiki (not .Repository.IsMirror)}}
|
||||
<a class="ui right floated muted" href="{{.RepoLink}}/wiki/_Sidebar?action=_edit" aria-label="{{.i18n.Tr "repo.wiki.edit_page_button"}}">{{svg "octicon-pencil"}}</a>
|
||||
<a class="ui right floated muted" href="{{.RepoLink}}/wiki/_Sidebar?action=_edit" aria-label="{{.locale.Tr "repo.wiki.edit_page_button"}}">{{svg "octicon-pencil"}}</a>
|
||||
{{end}}
|
||||
{{template "repo/unicode_escape_prompt" dict "EscapeStatus" .sidebarEscapeStatus "root" $}}
|
||||
{{.sidebarContent | Safe}}
|
||||
@@ -103,7 +103,7 @@
|
||||
{{if .footerPresent}}
|
||||
<div class="ui segment wiki-content-footer">
|
||||
{{if and .CanWriteWiki (not .Repository.IsMirror)}}
|
||||
<a class="ui right floated muted" href="{{.RepoLink}}/wiki/_Footer?action=_edit" aria-label="{{.i18n.Tr "repo.wiki.edit_page_button"}}">{{svg "octicon-pencil"}}</a>
|
||||
<a class="ui right floated muted" href="{{.RepoLink}}/wiki/_Footer?action=_edit" aria-label="{{.locale.Tr "repo.wiki.edit_page_button"}}">{{svg "octicon-pencil"}}</a>
|
||||
{{end}}
|
||||
{{template "repo/unicode_escape_prompt" dict "footerEscapeStatus" .sidebarEscapeStatus "root" $}}
|
||||
{{.footerContent | Safe}}
|
||||
@@ -115,10 +115,10 @@
|
||||
<div class="ui small basic delete modal">
|
||||
<div class="ui icon header">
|
||||
{{svg "octicon-trash"}}
|
||||
{{.i18n.Tr "repo.wiki.delete_page_button"}}
|
||||
{{.locale.Tr "repo.wiki.delete_page_button"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<p>{{.i18n.Tr "repo.wiki.delete_page_notice_1" ($title|Escape) | Safe}}</p>
|
||||
<p>{{.locale.Tr "repo.wiki.delete_page_notice_1" ($title|Escape) | Safe}}</p>
|
||||
</div>
|
||||
{{template "base/delete_modal_actions" .}}
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user