feat(ui): localize theme names (#7168)
Allow translating theme names. Not even for i18n reasons but because this way the menu is clearer and cleaner. The number of translated entries is kept minimal for now. It is easy to pollute locales with these names otherwise. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7168 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
parent
f015c00ecb
commit
584c504e25
7 changed files with 35 additions and 9 deletions
|
@ -330,6 +330,13 @@ func Appearance(ctx *context.Context) {
|
|||
ctx.Data["Title"] = ctx.Tr("settings.appearance")
|
||||
ctx.Data["PageIsSettingsAppearance"] = true
|
||||
ctx.Data["AllThemes"] = setting.UI.Themes
|
||||
ctx.Data["ThemeName"] = func(themeName string) string {
|
||||
fullThemeName := "themes.names." + themeName
|
||||
if ctx.Locale.HasKey(fullThemeName) {
|
||||
return ctx.Locale.TrString(fullThemeName)
|
||||
}
|
||||
return themeName
|
||||
}
|
||||
|
||||
var hiddenCommentTypes *big.Int
|
||||
val, err := user_model.GetUserSetting(ctx, ctx.Doer.ID, user_model.SettingsKeyHiddenCommentTypes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue