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

Translations: Replace texts in code with translated messages #81

Open
DonMul opened this issue Jan 23, 2019 · 9 comments
Open

Translations: Replace texts in code with translated messages #81

DonMul opened this issue Jan 23, 2019 · 9 comments

Comments

@DonMul
Copy link

DonMul commented Jan 23, 2019

Some (error) messages in the codebase are now hardcoded to an english message instead of making use of the translation service, but there is a translation possibility available

@Schnoop
Copy link
Contributor

Schnoop commented Sep 27, 2023

@frank9999 i'm hunting down this translation stuff at the moment. Do you think we have to translate the battle reports as well? Those reports are stored in the database and we have to create an entry for each language this game is supporting.

The trade off is of course that if you add a new language after some time, older reports are not available in the new added language.

The other option would be to store the reports as serialized Translateable Objects which will be translated while rendering the page.

Any suggestions?

@Schnoop
Copy link
Contributor

Schnoop commented Sep 27, 2023

The last option that comes to my mind right now is to store the translation identifier in one field, and the values that should get replaced in the another field as a serialized array. This solution will be fully backwards compatible as the only connection to the real text is the identifier which will be used in every language file that is available.

@frank9999
Copy link
Member

Hi @Schnoop, how do option 2 and 3 differ? I prefer to store the customizable/data in an serialized array or json in the database, and do the actual battle report generation during rendering with for example twig templates and translation files.

This has 3 benefits:

  • Keeps data stored in database limited, as we no longer store full reports, only necessary data to generate reports.
  • Allows us to change the battle report later, also for old battle reports.
  • We can add new languages later, and allow players to change language at runtime and see reports in their preferred language.

@Schnoop
Copy link
Contributor

Schnoop commented Sep 27, 2023

It only differs in what is stored in the database. Serialized Object or array.

@frank9999
Copy link
Member

Ah yes! So your last solution sounds perfect and is most future proof

@Schnoop
Copy link
Contributor

Schnoop commented Sep 27, 2023

How do we deals with existing data that are created atm?

@frank9999
Copy link
Member

We can truncate the old battle reports. I'll deploy these changes while creating new game worlds. Current world is ending some time soon

@Schnoop
Copy link
Contributor

Schnoop commented Oct 8, 2023

I have done a lot of stuff - although it is not finished yet. You can have a look at the feature branch here:

https://github.com/Schnoop/UltimateWarfare/tree/feature/Translation

@frank9999
Copy link
Member

Hi @Schnoop, thats a lot of changes! Would be great if you can make smaller merge requests in the future, makes it easier to go through the changes hehe.

I'm not really sure about the datamodel changes. What is the reason you split the datamodel into translation-entity models? Wouldn't it be easier to just use translation files for that as well? So just lookup and translate "Soldier" in language files like you do with all other changes? With the current proposed changes you will have to do translations in language files AND in the database.

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

No branches or pull requests

3 participants