Skip to content

Commit c8a26b0

Browse files
committed
rename conflicted keys
1 parent 7c3ca43 commit c8a26b0

File tree

22 files changed

+45
-72
lines changed

22 files changed

+45
-72
lines changed

build/update-locales.sh

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,22 @@
11
#!/bin/sh
22

33
# this script runs in alpine image which only has `sh` shell
4-
5-
set +e
6-
if sed --version 2>/dev/null | grep -q GNU; then
7-
SED_INPLACE="sed -i"
8-
else
9-
SED_INPLACE="sed -i ''"
10-
fi
11-
set -e
12-
13-
if [ ! -f ./options/locale/locale_en-US.ini ]; then
4+
if [ ! -f ./options/locale/locale_en-US.json ]; then
145
echo "please run this script in the root directory of the project"
156
exit 1
167
fi
178

18-
mv ./options/locale/locale_en-US.ini ./options/
19-
20-
# the "ini" library for locale has many quirks, its behavior is different from Crowdin.
21-
# see i18n_test.go for more details
22-
23-
# this script helps to unquote the Crowdin outputs for the quirky ini library
24-
# * find all `key="...\"..."` lines
25-
# * remove the leading quote
26-
# * remove the trailing quote
27-
# * unescape the quotes
28-
# * eg: key="...\"..." => key=..."...
29-
$SED_INPLACE -r -e '/^[-.A-Za-z0-9_]+[ ]*=[ ]*".*"$/ {
30-
s/^([-.A-Za-z0-9_]+)[ ]*=[ ]*"/\1=/
31-
s/"$//
32-
s/\\"/"/g
33-
}' ./options/locale/*.ini
34-
35-
# * if the escaped line is incomplete like `key="...` or `key=..."`, quote it with backticks
36-
# * eg: key="... => key=`"...`
37-
# * eg: key=..." => key=`..."`
38-
$SED_INPLACE -r -e 's/^([-.A-Za-z0-9_]+)[ ]*=[ ]*(".*[^"])$/\1=`\2`/' ./options/locale/*.ini
39-
$SED_INPLACE -r -e 's/^([-.A-Za-z0-9_]+)[ ]*=[ ]*([^"].*")$/\1=`\2`/' ./options/locale/*.ini
9+
mv ./options/locale/locale_en-US.json ./options/
4010

4111
# Remove translation under 25% of en_us
42-
baselines=$(wc -l "./options/locale_en-US.ini" | cut -d" " -f1)
12+
baselines=$(wc -l "./options/locale_en-US.json" | cut -d" " -f1)
4313
baselines=$((baselines / 4))
44-
for filename in ./options/locale/*.ini; do
14+
for filename in ./options/locale/*.json; do
4515
lines=$(wc -l "$filename" | cut -d" " -f1)
4616
if [ $lines -lt $baselines ]; then
4717
echo "Removing $filename: $lines/$baselines"
4818
rm "$filename"
4919
fi
5020
done
5121

52-
mv ./options/locale_en-US.ini ./options/locale/
22+
mv ./options/locale_en-US.json ./options/locale/

routers/web/admin/applications.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func EditApplicationPost(ctx *context.Context) {
7373

7474
// ApplicationsRegenerateSecret handles the post request for regenerating the secret
7575
func ApplicationsRegenerateSecret(ctx *context.Context) {
76-
ctx.Data["Title"] = ctx.Tr("_settings")
76+
ctx.Data["Title"] = ctx.Tr("settings_title")
7777
ctx.Data["PageIsAdminApplications"] = true
7878

7979
oa := newOAuth2CommonHandlers()

routers/web/explore/code.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func Code(ctx *context.Context) {
3131
ctx.Data["UsersPageIsDisabled"] = setting.Service.Explore.DisableUsersPage
3232
ctx.Data["OrganizationsPageIsDisabled"] = setting.Service.Explore.DisableOrganizationsPage
3333
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
34-
ctx.Data["Title"] = ctx.Tr("_explore")
34+
ctx.Data["Title"] = ctx.Tr("explore_title")
3535
ctx.Data["PageIsExplore"] = true
3636
ctx.Data["PageIsExploreCode"] = true
3737
ctx.Data["PageIsViewCode"] = true

routers/web/explore/org.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func Organizations(ctx *context.Context) {
2222

2323
ctx.Data["UsersPageIsDisabled"] = setting.Service.Explore.DisableUsersPage
2424
ctx.Data["CodePageIsDisabled"] = setting.Service.Explore.DisableCodePage
25-
ctx.Data["Title"] = ctx.Tr("_explore")
25+
ctx.Data["Title"] = ctx.Tr("explore_title")
2626
ctx.Data["PageIsExplore"] = true
2727
ctx.Data["PageIsExploreOrganizations"] = true
2828
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled

routers/web/explore/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func Repos(ctx *context.Context) {
149149
ctx.Data["UsersPageIsDisabled"] = setting.Service.Explore.DisableUsersPage
150150
ctx.Data["OrganizationsPageIsDisabled"] = setting.Service.Explore.DisableOrganizationsPage
151151
ctx.Data["CodePageIsDisabled"] = setting.Service.Explore.DisableCodePage
152-
ctx.Data["Title"] = ctx.Tr("_explore")
152+
ctx.Data["Title"] = ctx.Tr("explore_title")
153153
ctx.Data["PageIsExplore"] = true
154154
ctx.Data["ShowRepoOwnerOnList"] = true
155155
ctx.Data["PageIsExploreRepositories"] = true

routers/web/explore/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func Users(ctx *context.Context) {
134134
}
135135
ctx.Data["OrganizationsPageIsDisabled"] = setting.Service.Explore.DisableOrganizationsPage
136136
ctx.Data["CodePageIsDisabled"] = setting.Service.Explore.DisableCodePage
137-
ctx.Data["Title"] = ctx.Tr("_explore")
137+
ctx.Data["Title"] = ctx.Tr("explore_title")
138138
ctx.Data["PageIsExplore"] = true
139139
ctx.Data["PageIsExploreUsers"] = true
140140
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled

routers/web/org/setting_oauth2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func OAuth2ApplicationEdit(ctx *context.Context) {
8484

8585
// OAuthApplicationsRegenerateSecret handles the post request for regenerating the secret
8686
func OAuthApplicationsRegenerateSecret(ctx *context.Context) {
87-
ctx.Data["Title"] = ctx.Tr("_settings")
87+
ctx.Data["Title"] = ctx.Tr("settings_title")
8888
ctx.Data["PageIsOrgSettings"] = true
8989
ctx.Data["PageIsSettingsApplications"] = true
9090

routers/web/user/setting/account.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func AccountPost(ctx *context.Context) {
5757
}
5858

5959
form := web.GetForm(ctx).(*forms.ChangePasswordForm)
60-
ctx.Data["Title"] = ctx.Tr("_settings")
60+
ctx.Data["Title"] = ctx.Tr("settings_title")
6161
ctx.Data["PageIsSettingsAccount"] = true
6262
ctx.Data["Email"] = ctx.Doer.Email
6363

@@ -107,7 +107,7 @@ func EmailPost(ctx *context.Context) {
107107
}
108108

109109
form := web.GetForm(ctx).(*forms.AddEmailForm)
110-
ctx.Data["Title"] = ctx.Tr("_settings")
110+
ctx.Data["Title"] = ctx.Tr("settings_title")
111111
ctx.Data["PageIsSettingsAccount"] = true
112112
ctx.Data["Email"] = ctx.Doer.Email
113113

@@ -237,7 +237,7 @@ func DeleteAccount(ctx *context.Context) {
237237
return
238238
}
239239

240-
ctx.Data["Title"] = ctx.Tr("_settings")
240+
ctx.Data["Title"] = ctx.Tr("settings_title")
241241
ctx.Data["PageIsSettingsAccount"] = true
242242
ctx.Data["Email"] = ctx.Doer.Email
243243

routers/web/user/setting/applications.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func Applications(ctx *context.Context) {
3737
// ApplicationsPost response for add user's access token
3838
func ApplicationsPost(ctx *context.Context) {
3939
form := web.GetForm(ctx).(*forms.NewAccessTokenForm)
40-
ctx.Data["Title"] = ctx.Tr("_settings")
40+
ctx.Data["Title"] = ctx.Tr("settings_title")
4141
ctx.Data["PageIsSettingsApplications"] = true
4242
ctx.Data["UserDisabledFeatures"] = user_model.DisabledFeaturesWithLoginType(ctx.Doer)
4343

routers/web/user/setting/keys.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func Keys(ctx *context.Context) {
4545
// KeysPost response for change user's SSH/GPG keys
4646
func KeysPost(ctx *context.Context) {
4747
form := web.GetForm(ctx).(*forms.AddKeyForm)
48-
ctx.Data["Title"] = ctx.Tr("_settings")
48+
ctx.Data["Title"] = ctx.Tr("settings_title")
4949
ctx.Data["PageIsSettingsKeys"] = true
5050
ctx.Data["DisableSSH"] = setting.SSH.Disabled
5151
ctx.Data["BuiltinSSH"] = setting.SSH.StartBuiltinServer

0 commit comments

Comments
 (0)