loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(build): uniform ini parsing (#7429)

- Use the existing ini parser for the `lint-locale` and `lint-locale-usage` tooling.
- This discovered that the previous ini parser was not correctly parsing certain types of string, specifically those with `;` as it's seen as a comment. It now properly 'unescapes' that and is not seen as a comment break.
- Discovered-by: @fogti

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7429
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>

authored by

Gusted
Gusted
and committed by
Gusted
ba5b157f 4ab40ed6

+4 -9
+1 -1
build/lint-locale/lint-locale_test.go
··· 60 60 t.Run("Escaped HTML characters", func(t *testing.T) { 61 61 assert.Empty(t, checkLocaleContent([]byte("activity.git_stats_push_to_branch = `إلى %s و\"`"))) 62 62 63 - assert.Equal(t, []string{"key: و\x1b[31m&nbsp\x1b[0m\x1b[32m\u00a0\x1b[0m"}, checkLocaleContent([]byte(`key = و&nbsp;`))) 63 + assert.Equal(t, []string{"key: و\x1b[31m&nbsp;\x1b[0m\x1b[32m\u00a0\x1b[0m"}, checkLocaleContent([]byte(`key = و&nbsp;`))) 64 64 }) 65 65 } 66 66
+3 -8
modules/translation/localeiter/utils.go
··· 10 10 "encoding/json" //nolint:depguard 11 11 "fmt" 12 12 13 - "gopkg.in/ini.v1" //nolint:depguard 13 + "forgejo.org/modules/setting" 14 14 ) 15 15 16 16 func IterateMessagesContent(localeContent []byte, onMsgid func(string, string) error) error { 17 - // Same configuration as Forgejo uses. 18 - cfg := ini.Empty(ini.LoadOptions{ 19 - IgnoreContinuation: true, 20 - }) 21 - cfg.NameMapper = ini.SnackCase 22 - 23 - if err := cfg.Append(localeContent); err != nil { 17 + cfg, err := setting.NewConfigProviderForLocale(localeContent) 18 + if err != nil { 24 19 return err 25 20 } 26 21