Create Crafts & Additions

Create Crafts & Additions

61M Downloads

Internationalize PonderScenes text descriptions instead of using hardcoded strings

Shen-Ming-Hong opened this issue ยท 0 comments

commented

๐Ÿ“ Suggestion: Internationalize PonderScenes Text Descriptions

๐Ÿ” Issue Description

Currently, the PonderScenes.java class contains hardcoded English text strings for all Ponder scene descriptions, which prevents players from different countries/regions from enjoying these interactive tutorials in their native languages.

๐Ÿšจ Current Problem

In src/main/java/com/mrh0/createaddition/ponder/PonderScenes.java, text descriptions are hardcoded:

scene.overlay().showText(50)
    .text("Electric Motors are a compact and configurable source of Rotational Force")
    .placeNearTarget()
    .pointAt(util.vector().topOf(motor));
scene.overlay().showText(70)
    .text("Scrolling on the back panel changes the RPM of the motors' rotational output")
    .placeNearTarget()
    .pointAt(blockSurface);

โœ… Proposed Solution

The project already has excellent localization support with language files in src/main/resources/assets/createaddition/lang/ including language keys like:

"createaddition.ponder.electric_motor.header": "Generating Rotational Force using Electric Motors",
"createaddition.ponder.electric_motor.text_1": "Electric Motors are a compact and configurable source of Rotational Force",
"createaddition.ponder.electric_motor.text_2": "Scrolling on the back panel changes the RPM of the motor's rotational output",
"createaddition.ponder.electric_motor.text_3": "The Electric Motor requires a source of energy",
"createaddition.ponder.electric_motor.text_4": "The motor's energy consumption is determined by the set RPM"

However, the code doesn't use these language keys! Instead, it should use translation keys like:

scene.overlay().showText(50)
    .text(Component.translatable("createaddition.ponder.electric_motor.text_1"))
    .placeNearTarget()
    .pointAt(util.vector().topOf(motor));

๐ŸŒ Benefits

  1. Better Player Experience: Players worldwide can enjoy Ponder tutorials in their native language
  2. Consistent Localization: The mod already supports 19+ languages, but Ponder scenes remain English-only
  3. Community Contribution: Translators can contribute to improving Ponder content for their regions
  4. Professional Polish: Complete internationalization demonstrates attention to detail

๐Ÿ“‹ Affected Files

  • src/main/java/com/mrh0/createaddition/ponder/PonderScenes.java - All text() method calls need to use translation keys
  • Language files already contain the necessary keys but aren't being used

๐ŸŽฏ Impact

This affects all international players who want to understand the Ponder tutorials. With Create Addition being such a popular mod with a global player base, proper internationalization would significantly improve accessibility.

๐Ÿ“š Technical Implementation

The change would involve replacing hardcoded strings with Component.translatable() calls using the existing language keys. The language files already exist and contain the translations - they just need to be connected to the code.

Would be happy to help implement this if needed! ๐Ÿ› ๏ธ