Skip to content

[8649] Fix incorrect MIME type labels for application/javascript and text/texmacs in de.json translations#4897

Open
jvega190 wants to merge 2 commits into
craftercms:developfrom
jvega190:enhancement/8649
Open

[8649] Fix incorrect MIME type labels for application/javascript and text/texmacs in de.json translations#4897
jvega190 wants to merge 2 commits into
craftercms:developfrom
jvega190:enhancement/8649

Conversation

@jvega190

@jvega190 jvega190 commented Jun 19, 2026

Copy link
Copy Markdown
Member

craftercms/craftercms#8649

Summary by CodeRabbit

  • Bug Fixes
    • Improved authentication flow so login success is confirmed after verifying the auth session.
    • Cleared stale login errors when initiating a new login attempt.
    • Enhanced the “incorrect username or password” message with a clearer warning-style alert.
  • Localization
    • Corrected MIME type labels across German, Spanish, and Korean (JavaScript and TeXmacs).
    • Added proper MIME labeling for TypeScript files.

…d Korean files; add TypeScript mime type definition.
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Fixes mislabeled MIME type translation entries for application/javascript (was "Typescript (tsx)") and text/texmacs (was "Typescript (ts)") in source definitions and locale files, adds a new application/typescript mapping, and refines the authentication login flow with session token verification, improved error state clearing, explicit AjaxError handling in the epic, and enhanced error messaging UI in the AuthMonitor component.

Changes

MIME Type Label Corrections

Layer / File(s) Summary
Source definitions and locale translations
ui/app/src/utils/mimeTypes.ts, ui/app/src/translations/de.json, ui/app/src/translations/es.json, ui/app/src/translations/ko.json
application/javascript defaultMessage corrected to "JavaScript" and text/texmacs corrected to "TeXmacs" in the source defineMessages block; a new application/typescript entry with defaultMessage "TypeScript" is added. The same two key corrections are applied to the German, Spanish, and Korean translation files.

Authentication Flow Improvements

Layer / File(s) Summary
Session verification and login state initialization
ui/app/src/services/auth.ts, ui/app/src/state/reducers/auth.ts
The login service now calls obtainAuthToken() after the studio GET to verify the authentication session before completing the login flow. The auth reducer clears any existing error state to null when login is initiated, ensuring a clean error state before the login attempt.
Epic error handling refinement
ui/app/src/state/epics/auth.ts
The login epic replaces generalized catchAjaxError with explicit error catching that conditionally dispatches loginFailed only for AjaxError instances, rethrowing other error types. Imports updated to include of and AjaxError.
Error message and visual UI treatment
ui/app/src/components/AuthMonitor/AuthMonitor.tsx
AuthMonitor imports palette and WarningRounded for styling, updates the incorrectPasswordMessage to "Incorrect username or password. Please try again.", and renders a centered warning Typography with icon for error code 6004 instead of the generic ApiResponseErrorState.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Suggested reviewers

  • sumerjabri
  • rart
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only provides a GitHub issue link without substantive details about the changes, missing explanations of what was fixed and why. Expand the description to explain the MIME type corrections made across translation files and the addition of the application/typescript entry.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: correcting MIME type labels in translation files, though it focuses on de.json while changes span three locales.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/app/src/utils/mimeTypes.ts`:
- Around line 96-98: The defaultMessage for the 'application/typescript' MIME
type entry uses incorrect capitalization. Locate the mimeTypes object where
'application/typescript' is defined and update its defaultMessage value from
'Typescript' to 'TypeScript' to match the canonical spelling with a capital S.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 57870121-db7a-485a-9ff0-e699c0102e77

📥 Commits

Reviewing files that changed from the base of the PR and between 20f1940 and e4b5b67.

📒 Files selected for processing (4)
  • ui/app/src/translations/de.json
  • ui/app/src/translations/es.json
  • ui/app/src/translations/ko.json
  • ui/app/src/utils/mimeTypes.ts

Comment thread ui/app/src/utils/mimeTypes.ts Outdated
@jvega190

Copy link
Copy Markdown
Member Author

@coderabbitai can you check if everything looks good? Please give it a final review before I hand over for human review

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== mimeTypes.ts ==="
cat ui/app/src/utils/mimeTypes.ts

echo ""
echo "=== de.json - mimeTypes section ==="
python3 -c "
import json
with open('ui/app/src/translations/de.json') as f:
    data = json.load(f)
mime = {k: v for k, v in data.items() if k.startswith('mimeTypes')}
for k, v in sorted(mime.items()):
    print(f'{k}: {v}')
"

echo ""
echo "=== es.json - mimeTypes section ==="
python3 -c "
import json
with open('ui/app/src/translations/es.json') as f:
    data = json.load(f)
mime = {k: v for k, v in data.items() if k.startswith('mimeTypes')}
for k, v in sorted(mime.items()):
    print(f'{k}: {v}')
"

echo ""
echo "=== ko.json - mimeTypes section ==="
python3 -c "
import json
with open('ui/app/src/translations/ko.json') as f:
    data = json.load(f)
mime = {k: v for k, v in data.items() if k.startswith('mimeTypes')}
for k, v in sorted(mime.items()):
    print(f'{k}: {v}')
"

echo ""
echo "=== Check for all translation files ==="
fd -e json . ui/app/src/translations/

echo ""
echo "=== Compare mimeTypes keys across all translation files ==="
python3 -c "
import json, os, glob

files = sorted(glob.glob('ui/app/src/translations/*.json'))
all_data = {}
for f in files:
    lang = os.path.basename(f)
    with open(f) as fh:
        data = json.load(fh)
    mime = {k: v for k, v in data.items() if k.startswith('mimeTypes')}
    all_data[lang] = mime

# Print mimeTypes keys for each language
for lang, mime in all_data.items():
    print(f'--- {lang} ---')
    for k, v in sorted(mime.items()):
        print(f'  {k}: {v}')
    print()
"

Length of output: 22253



@jvega190 Everything looks good! Here's a summary of what I verified:

✅ Core Fix

All three translation files (de.json, es.json, ko.json) now correctly map:

  • mimeTypes.application/javascript"JavaScript" (was mistakenly "TypeScript (tsx)")
  • mimeTypes.text/texmacs"TeXmacs" (was mistakenly "TypeScript (ts)")

✅ mimeTypes.ts

  • application/javascript and text/texmacs defaults are correctly set to "JavaScript" and "TeXmacs" respectively.
  • New application/typescript entry added with defaultMessage: 'TypeScript' — properly defined.

✅ Consistency

All three locale files have identical, consistent key sets with no stray entries or mismatches.

📝 Minor Note (non-blocking)

The new mimeTypes.application/typescript key is not present in any of the three JSON translation files. This is fine — react-intl falls back to the defaultMessage: 'TypeScript' in mimeTypes.ts, and "TypeScript" is a proper noun that doesn't require localization. The pattern is also consistent with how other entries are handled in this codebase.

The PR is ready to hand off for human review! 🐇

@jvega190 jvega190 marked this pull request as ready for review June 22, 2026 16:51
@jvega190 jvega190 requested a review from rart as a code owner June 22, 2026 16:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/app/src/components/AuthMonitor/AuthMonitor.tsx`:
- Line 48: The default message for authMonitor.incorrectPasswordMessage in
AuthMonitor.tsx has been updated to "Incorrect username or password. Please try
again.", but the localized translation files (such as de.json and other locale
files in ui/app/src/translations/) still contain the old wording "Incorrect
password...". Update all locale entries for the
authMonitor.incorrectPasswordMessage key across all translation files to match
the new default message so that non-English users see the updated copy.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4d469b7b-948b-4b0a-9440-c9b4f32ec3a5

📥 Commits

Reviewing files that changed from the base of the PR and between e4b5b67 and 3a8cd9b.

📒 Files selected for processing (5)
  • ui/app/src/components/AuthMonitor/AuthMonitor.tsx
  • ui/app/src/services/auth.ts
  • ui/app/src/state/epics/auth.ts
  • ui/app/src/state/reducers/auth.ts
  • ui/app/src/utils/mimeTypes.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • ui/app/src/utils/mimeTypes.ts

Comment thread ui/app/src/components/AuthMonitor/AuthMonitor.tsx Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant