go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.16k stars 5.49k forks source link

Allow to add custom locale without overriding other locales #17713

Open gvethon opened 3 years ago

gvethon commented 3 years ago

Feature Description

In short: allow to add custom locales without overriding whole locale*.ini file. Use case: adding custom locales texts to Gitea requires placing an altered locale file in GITEA_CUSTOM directory. This file is a copy of locale file from Gitea source code. Is it possible to allow definig custom locale properties and add it to Gitea defined locales? Overriding locales may produce many problems while upgrading.

Screenshots

No response

mscherer commented 2 years ago

So, what is the use case in the first place, what would be achieved with custom locales ?

gvethon commented 2 years ago

The usecase may be adding custom links to or overriding header in base/head_navbar.tmpl. I want to allow to translate that links like others. I am using gitea in my project as repository to store users projects and want to unify headers and footers as in the main application.

telsch commented 2 years ago

If by adding custom locales you mean a "drop-in" locale file to overwrite existing translation partially i would appreciate that as well.

badNightmare commented 2 years ago

I think it is very nice to have, because you can customise the startpage and still have all the language switching functionality supported. Otherwise you would just be stuck with one language as soon as you modify the home.tmpl.

danparisd commented 11 months ago

We would also benefit from this functionality.

In the meantime, we achieved this by writing a go script that replaces and adds custom locale k/v's to the ones extracted from the binary at build time using docker.

https://github.com/WycliffeAssociates/WACS/blob/prod/wacs-gitea/Dockerfile

https://github.com/WycliffeAssociates/WACS/blob/prod/wacs-gitea/merge-locale/merge.go

sorry about the cruft in that repo, it's still WIP.