App.i18n.get() locale translation not working

Steps to reproduce:

  • put pl.php translation file in /config/cockpit/i18n/
  • set languages in config/config.yaml (or config/config.php):
i18n: pl
languages:
  pl: Polski
  en: English
  • set user language in cockpit admin
  • translations in php files that use @lang('…') in admin panel works
  • translations from js files that use App.i18n.get(’…’) in admin panel shows english labels
  • when debug: true console shows:
GET http://localhost:8000/content/cockpit.i18n.data net::ERR_ABORTED 404 (Not Found)
  • went through js files to see what’s going on and created manually cockpit.i18n.data with test content:
i18n.__data = {
    "Search for anything..." : "Poszukaj czegoś..."
}
  • translation of placeholder worked

Problem: Cannot get translation for parts of admin panel that uses App.i18n.get() from pl.php

I’ve found out that this problem is connected to route names. Dot in route name breaks it: [BUG] Translations don't work properly/Route names with dots are broken [affects stable and dev]