Phase 7: languages
- Complete Spanish (neutral Latin American, Paraguay friendly, no inverted marks) and Dutch catalogs, including the Mini App and owner texts - Command menus per language in three scopes (private, group members, group admins); per-chat menus follow a user's /language and a group's /grouplang, from chat and from the Mini App - Bot name, description and short description per language, sent only when the catalog text changes (TELEGRAM_SET_PROFILE) - Dates from the catalog, numbers, sizes and durations per locale - Pseudo-locale en-XA generated from English (I18N_PSEUDO), owners only - Catalog checks: completeness, placeholders, tags, commands, plurals, Telegram length limits, untranslated text, unused and missing IDs - CI workflow; make i18n-check; docs/TRANSLATING.md - Test fix: the queued-download helper could match another chat's status Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4f11f939a0
commit
f1f9c6156c
+14
-18
@@ -263,22 +263,25 @@ func (b *Bot) cmdGroupLang(ctx context.Context, m *telego.Message, act actor) {
|
||||
return
|
||||
}
|
||||
arg := strings.ToLower(strings.TrimSpace(commandArgs(m)))
|
||||
usage := i18n.Args{"Langs": strings.Join(b.visibleLangs(act.user.ID), ", ")}
|
||||
changed, newLang := false, ""
|
||||
b.changeSettings(ctx, m, act, func(st *db.GroupSettings) (string, i18n.Args) {
|
||||
if arg == "" {
|
||||
return "!grouplang.usage", i18n.Args{"Langs": strings.Join(b.tr.Langs(), ", ")}
|
||||
return "!grouplang.usage", usage
|
||||
}
|
||||
if arg == "auto" {
|
||||
st.Lang = ""
|
||||
st.Lang, changed = "", true
|
||||
return "grouplang.auto", nil
|
||||
}
|
||||
for _, l := range b.tr.Langs() {
|
||||
if l == arg {
|
||||
st.Lang = l
|
||||
return "grouplang.set", i18n.Args{"Lang": b.tr.T(l, "language.name", nil)}
|
||||
}
|
||||
if l := b.findLang(arg, act.user.ID); l != "" {
|
||||
st.Lang, changed, newLang = l, true, l
|
||||
return "grouplang.set", i18n.Args{"Lang": b.tr.T(l, "language.name", nil)}
|
||||
}
|
||||
return "!grouplang.usage", i18n.Args{"Langs": strings.Join(b.tr.Langs(), ", ")}
|
||||
return "!grouplang.usage", usage
|
||||
})
|
||||
if changed {
|
||||
b.SyncGroupMenu(ctx, m.Chat.ID, newLang)
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Bot) cmdAutoDetect(ctx context.Context, m *telego.Message, act actor) {
|
||||
@@ -566,10 +569,7 @@ func (b *Bot) cbSetQuality(ctx context.Context, q *telego.CallbackQuery, act act
|
||||
func (b *Bot) cmdLanguage(ctx context.Context, m *telego.Message, act actor) {
|
||||
var row []telego.InlineKeyboardButton
|
||||
var rows [][]telego.InlineKeyboardButton
|
||||
for _, l := range b.tr.Langs() {
|
||||
if b.tr.Hidden(l) {
|
||||
continue
|
||||
}
|
||||
for _, l := range b.visibleLangs(act.user.ID) {
|
||||
// Each language is listed under its own name.
|
||||
row = append(row, button(b.tr.T(l, "language.name", nil), cbData(cbLanguage, l)))
|
||||
if len(row) == 3 {
|
||||
@@ -584,12 +584,7 @@ func (b *Bot) cmdLanguage(ctx context.Context, m *telego.Message, act actor) {
|
||||
func (b *Bot) cbSetLanguage(ctx context.Context, q *telego.CallbackQuery, act actor, value string) {
|
||||
lang := ""
|
||||
if value != "auto" {
|
||||
for _, l := range b.tr.Langs() {
|
||||
if l == value {
|
||||
lang = l
|
||||
}
|
||||
}
|
||||
if lang == "" {
|
||||
if lang = b.findLang(value, act.user.ID); lang == "" {
|
||||
b.answer(ctx, q, b.tr.T(act.lang, "notice.expired", nil), false)
|
||||
return
|
||||
}
|
||||
@@ -602,6 +597,7 @@ func (b *Bot) cbSetLanguage(ctx context.Context, q *telego.CallbackQuery, act ac
|
||||
if shown == "" {
|
||||
shown = b.tr.Resolve(act.user.Lang)
|
||||
}
|
||||
b.SyncUserMenu(ctx, act.user.ID, lang)
|
||||
b.answer(ctx, q, b.tr.T(shown, "notice.saved", nil), false)
|
||||
if q.Message != nil {
|
||||
_ = b.edit(ctx, q.Message.GetChat().ID, int64(q.Message.GetMessageID()), false,
|
||||
|
||||
Reference in New Issue
Block a user