ソースを参照

Merge pull request #33404 from overleaf/copilot/fix-accepts-language-deprecation

Fix deprecated req.acceptsLanguage → req.acceptsLanguages in Translations.mjs

GitOrigin-RevId: db9f09d999158ba5f9f084bc1a8334954a55cd79
Andrew Rumble 1 ヶ月 前
コミット
d22cea01ce

+ 1 - 1
services/web/app/src/infrastructure/Translations.mjs

@@ -125,7 +125,7 @@ function setLangBasedOnDomainMiddleware(req, res, next) {
   // the Accept-Language header), then set flag which will show a banner
   // offering to switch to the appropriate library
   const detectedLanguageCode =
-    req.acceptsLanguage(availableLanguageCodes) || fallbackLanguageCode
+    req.acceptsLanguages(availableLanguageCodes) || fallbackLanguageCode
   if (req.language !== detectedLanguageCode) {
     res.locals.suggestedLanguageSubdomainConfig =
       subdomainConfigs.get(detectedLanguageCode)

+ 1 - 1
services/web/test/unit/src/infrastructure/Translations.test.mjs

@@ -38,7 +38,7 @@ describe('Translations', function () {
       headers: {
         'accept-language': '',
       },
-      acceptsLanguage: express.request.acceptsLanguages,
+      acceptsLanguages: express.request.acceptsLanguages,
     }
     res = {
       locals: {},