Skip to content

Commit 022f017

Browse files
committed
fix lang
1 parent 49a4e45 commit 022f017

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

docs/content/doc/installation/with-docker.en-us.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ services:
9898

9999
## Databases
100100

101+
### SQLite3 database
102+
103+
Use the above "basic" docker-compose config, set "Database Type" to SQLite3 on the installation page.
104+
105+
SQLite3 is only suitable for small instance and for only a few users.
106+
It's recommended to use other database servers for production instances.
107+
101108
### MySQL database
102109

103110
To start Gitea in combination with a MySQL database, apply these changes to the

modules/web/middleware/locale.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func Locale(resp http.ResponseWriter, req *http.Request) translation.Locale {
1919
// 1. Check URL arguments.
2020
lang := req.URL.Query().Get("lang")
2121
changeLang := lang != ""
22+
skipHandler := req.URL.Query().Get("lang_skip_handler") != ""
2223

2324
// 2. Get language information from cookies.
2425
if len(lang) == 0 {
@@ -46,7 +47,15 @@ func Locale(resp http.ResponseWriter, req *http.Request) translation.Locale {
4647
SetLocaleCookie(resp, lang, 1<<31-1)
4748
}
4849

49-
return translation.NewLocale(lang)
50+
err := translation.NewLocale(lang)
51+
if err != nil {
52+
return err
53+
}
54+
55+
if skipHandler {
56+
resp.WriteHeader(http.StatusNoContent)
57+
}
58+
return nil
5059
}
5160

5261
// SetLocaleCookie convenience function to set the locale cookie consistently

routers/install/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func Install(ctx *context.Context) {
113113
}
114114
}
115115
if !isCurDBTypeSupported {
116-
curDBType = "mysql"
116+
curDBType = setting.SupportedDatabaseTypes[0]
117117
}
118118
ctx.Data["CurDbType"] = curDBType
119119

web_src/js/features/common-global.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ export function initHeadNavbarContentToggle() {
3636

3737
export function initFootLanguageMenu() {
3838
function linkLanguageAction() {
39-
const $this = $(this);
40-
$.post($this.data('url')).always(() => {
39+
let changeLangUrl = $(this).attr('data-url');
40+
changeLangUrl += changeLangUrl.includes('?') ? '&' : '?';
41+
// Only use "lang_skip_handler" for ajax. Page links should not have this parameter because crawlers need to get the full page
42+
changeLangUrl += 'lang_skip_handler=1';
43+
$.get(changeLangUrl).always(() => {
4144
window.location.reload();
4245
});
4346
}

0 commit comments

Comments
 (0)