Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up language strings, add openomf-translations submodule #737

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

Nopey
Copy link
Contributor

@Nopey Nopey commented Nov 3, 2024

this PR:

  • Generates an unnamed enum full of lang string indexes like LangPilot
  • Replaces all uses of lang_get + hardcoded value with a variant from said enum.
  • Reduces translator burden by not shipping unused language strings.
  • Ships a single localization file per language (not counting tournament localization, that's another PR's problem)
  • Reduces runtime memory usage by retaining the useful language strings' data in a single contigous allocation, and discarding their description.

Rationale for using cmake codegen instead of a straight C enum:

  • Since we're no longer generating ENGLISH.LNG from OMF ENGLISH.DAT, this is no longer relevant-- it is now an enum with two C macros in languages.h!

OMF ENGLISH.DAT consumes 65,397 bytes of memory after discarding the descriptions
A cut down OpenOMF ENGLISH.LNG consumes 35,257 bytes of memory and only contains 458 strings.

@Nopey Nopey force-pushed the language branch 3 times, most recently from 7dfff8c to 7fd5bbb Compare November 4, 2024 07:58
@Nopey Nopey changed the title Towards Monolithic OpenOMF language files Move all language strings into OpenOMF ${LANG}.LNG Nov 4, 2024
@Nopey Nopey force-pushed the language branch 4 times, most recently from 1909b28 to 59a33b4 Compare November 5, 2024 00:10
@Nopey Nopey marked this pull request as ready for review November 5, 2024 00:27
@katajakasa
Copy link
Member

This seems messy and difficult. Would it be better to just create our own language files, add only text that is used and include them to the project? Then we could drop the original language files completely.

@Nopey
Copy link
Contributor Author

Nopey commented Nov 25, 2024

Added "Add language string for Text Encoding", so there's something signalling whether the .LNG is in utf-8 or cp437 EDIT: removed that commit
Rebased on master to resolve merge conflict with stdbool-everywhere pr.

Intentionally not removing the ENGLISH.DAT + scripts we wrote -> ENGLISH.LNG pipeline, because despite its complexity it allows us to avoid commiting OMF assets into the repo. EDIT: those assets now live in the openomf-translations repo

Should I remove the Dansk Maskinoversottelse? its derivative of ENGLISH.DAT. EDIT: removed.

@Nopey Nopey force-pushed the language branch 5 times, most recently from 4624a25 to 99b68e8 Compare January 4, 2025 06:36
@Nopey
Copy link
Contributor Author

Nopey commented Jan 4, 2025

the resources/translations submodule is checked out to omf2097/openomf-translations#1

@Nopey Nopey changed the title Move all language strings into OpenOMF ${LANG}.LNG Clean up language strings, add openomf-translations submodule Jan 4, 2025
src/game/scenes/arena.c Outdated Show resolved Hide resolved
src/game/scenes/mechlab/lab_menu_main.c Show resolved Hide resolved
mrannanj
mrannanj previously approved these changes Jan 6, 2025
Copy link
Member

@mrannanj mrannanj left a comment

Choose a reason for hiding this comment

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

Still undecided about submodules, but initially okay.

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.

3 participants