Skip to content

[2.x] Hardcoded gambit keywords prevent localization #4566

@yannisme

Description

@yannisme

Current Behavior

flarum's filtering syntax uses hardcoded English keywords for parsing.
translating them into Chinese or other Languages renders the filtering ineffective.
flarum-subscriptionsflarum-tags,and so on...

As shown in the flarum-subscriptions gambit configuration:

flarum-subscriptions:
    gambits:
      discussions:
        subscription:
          following_key: following
          ignoring_key: ignoring

The values following and ignoring are hardcoded English keywords. They cannot be translated into Chinese,otherwise, the search filters will stop working.

Steps to Reproduce

After localizing such keys or filter commands into other languages, once that language is enabled, normal filtering or searching will no longer work.

Expected Behavior

Maybe, Introduce a localization alias system for gambit keywords? Keep the original hardcoded English keywords as internal identifiers, but allow language packs to define localized aliases. During parsing, the gambit matcher should accept both the original English keyword and any defined localized aliases.

Screenshots

No response

Environment

  • Flarum version: 2.0.0-beta8
  • Website URL: https://discuss.flarum.org.cn/
  • Webserver: [nginx]
  • Hosting environment: [vps]
  • PHP version: 8.3.27
  • Browser: [Edge/Safari]

Output of php flarum info

Flarum core: 2.0.0-beta.8
PHP version: CLI: 8.3.27, Web: 8.3.27
PHP memory limit: CLI: 800M, Web: unable to detect
MySQL version: 8.0.34
Loaded extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, ctype, curl, dom, filter, ftp, gd, gettext, hash, iconv, intl, json, SPL, session, pcntl, standard, mysqlnd, PDO, pdo_mysql, pdo_sqlite, Phar, posix, random, Reflection, mysqli, shmop, SimpleXML, soap, sockets, sodium, sysvsem, tokenizer, xml, xmlreader, xmlwriter, zip, mbstring, exif, fileinfo
+--------------------------------+---------------+--------+-------+
| Flarum Extensions              |               |        |       |
+--------------------------------+---------------+--------+-------+
| ID                             | Version       | Commit | Notes |
+--------------------------------+---------------+--------+-------+
| flarum-flags                   | v2.0.0-beta.8 |        |       |
| flarum-tags                    | v2.0.0-beta.8 |        |       |
| flarum-approval                | v2.0.0-beta.8 |        |       |
| flarum-suspend                 | v2.0.0-beta.8 |        |       |
| flarum-mentions                | v2.0.0-beta.8 |        |       |
| flarum-subscriptions           | v2.0.0-beta.8 |        |       |
| flarum-lock                    | v2.0.0-beta.8 |        |       |
| fof-user-directory             | 2.0.0-beta.5  |        |       |
| fof-follow-tags                | 2.0.0-beta.6  |        |       |
| ramon-avocado                  | 2.1.17-beta   |        |       |
| quasimo-tag-sidebar            | v2.0.21       |        |       |
| ianm-log-viewer                | 2.0.0-beta.2  |        |       |
| huseyinfiliz-stickiest         | 2.0.0-beta.2  |        |       |
| huseyinfiliz-leaderboard       | 2.0.0-beta.1  |        |       |
| fof-user-bio                   | 2.0.0-beta.3  |        |       |
| fof-upload                     | 2.0.0-beta.4  |        |       |
| fof-split                      | 2.0.0-beta.3  |        |       |
| fof-profile-image-crop         | 2.0.0-beta.1  |        |       |
| fof-prevent-necrobumping       | 2.0.0-beta.1  |        |       |
| fof-pages                      | 2.0.0-beta.2  |        |       |
| fof-move-posts                 | v2.0.0-beta.4 |        |       |
| fof-moderator-warnings         | 2.0.0-beta.4  |        |       |
| fof-merge-discussions          | 2.0.0-beta.2  |        |       |
| fof-links                      | 2.0.0-beta.2  |        |       |
| fof-linguist                   | 2.0.0-beta.1  |        |       |
| fof-github-autolink            | 2.0.0-beta.2  |        |       |
| fof-formatting                 | 2.0.0-beta.2  |        |       |
| fof-best-answer                | 2.0.0-beta.5  |        |       |
| flarum-sticky                  | v2.0.0-beta.8 |        |       |
| flarum-statistics              | v2.0.0-beta.8 |        |       |
| flarum-nicknames               | v2.0.0-beta.8 |        |       |
| flarum-messages                | v2.0.0-beta.8 |        |       |
| flarum-markdown                | v2.0.0-beta.8 |        |       |
| flarum-likes                   | v2.0.0-beta.8 |        |       |
| flarum-lang-english            | v2.0.0-beta.8 |        |       |
| flarum-lang-chinese-simplified | 2.x-dev       |        |       |
| flarum-extension-manager       | v2.0.0-beta.8 |        |       |
| flarum-emoji                   | v2.0.0-beta.8 |        |       |
| flarum-bbcode                  | v2.0.0-beta.8 |        |       |
| flarum-akismet                 | v2.0.0-beta.8 |        |       |
| ekumanov-forum-widgets         | v1.1.1        |        |       |
+--------------------------------+---------------+--------+-------+
Base URL: https://discuss.flarum.org.cn
Installation path: /www/wwwroot/discuss.flarum.org.cn
Queue driver: sync
Session driver: file
Scheduler status: 激活
Mail driver: smtp
Debug mode: off

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions