Factorio-Access / FactorioAccess

An accessibility mod for the video game Factorio, making the game accessible to the blind and visually impaired.
Other
24 stars 9 forks source link

Move the hardcoded text to the locale files. #240

Open ness056 opened 3 months ago

ness056 commented 3 months ago

1. Is your feature request related to a problem? Please describe.

Hello there, the french community Factorio discord has created a mod that translates other mods to french. Today it translates over 500 mods, including all the biggest ones. Recently someone joined the discord and asked if it would be possible to add Factorio Access to the translation mod. The problem is that a lot of the text used in your mod are hardcoded in the lua files and not in the locale files, which makes the translation of most of the mod impossible.

2. Describe the solution you'd like

If you could move as many as possible of that in the locale, it would be really appreciated!

ness056 commented 3 months ago

Also, I have a question, if we do that translation, will the voice synthesizer recognize it is french, or will it think it is English and try to pronounce it in English? Because if it doesn't recognize that, the translation wouldn't be really useful

LevFendi commented 3 months ago

Hello and thank you for reaching out. Locale is an important part of our mod that remains underdeveloped but indeed we will at one point go through the hundreds of hardcoded strings and move them to locale files. We aim to have support for multiple locales eventually, including the extensive in-game tutorial. I am glad that we can rely on your community for extensive French translation when we are ready for it!

As for your question, I am no expert but I am sure that screen readers have a way to handle language switching. @ahicks92 can give you a far more informed answer.

ohylli commented 3 months ago

The mod usually speaks through the user's screen reader such as NVDA. And NVDA uses which ever voice the user has chosen to use. Now some speech synthesizers can indeed switch language dynamically based on context like language tags on a web page. But it is not really relevant here. A french speaking user of the mod would have a French voice selected in their screen reader.

ahicks92 commented 3 months ago

Yeah, that's right. Sorry I didn't see this sooner though I guess it's still soon. The launcher should already be set up for this. If they're not using a screen reader then probably their default OS synth is configured right.

Language switching only works fully reliably on the web, so while that is indeed something they can do, it's not something the mod will ever handle. Also I suspect most of us turn it off anyway because it's much more likely to find invalid markup that turns the first language into something random, e.g. English text marked as Spanish.

Basically: the mod can't do anything about selected synth but it's not our job anyway.

To add a little bit of useful context, we have 2.0 in October and the mod also basically has to build all strings up algorithmically. At least for code I write, I aim for all future stuff to be localizable, but it's sadly not as simple as flipping through the files and copy/paste. If you have a programmer who knows Lua I wouldn't mind helping them get started as it is mostly doing the same thing over and over and over, but it does require probably a couple hundred small refactors at minimum.

christopherpross commented 1 month ago

Hey, I would be interested in helping you prepare the mod for the translations, as I would like to contribute a German translation later on. I've looked around a bit in the Lua code and I think this would be doable. Of course not in a week or so, but it's not an impossible task.

ahicks92 commented 1 month ago

Now is the worst possible time. In order to support 2.0, we are having to rewrite large portions of the code. The good news is that where possible we are making it localisable, and the better news is that getting things working again isn't going to require waiting around for APIs, at least as far as the base game. But the bad news is that you can expect translation work to break even if you aren't touching the code, and we aren't actively maintaining the main branch until we can get things in order. For example, I personally am in the process of rewriting how research works, and we even have to redo transport belts. Things are bad enough that "place a burner mining drill" was an achievement. If you want to follow that, search for issues labeled with 2.0-blocking, or watch the f2.0-dev branch.

Once that's done, we'd be happy to work with you. We'd also be happy to work with you if you wanted to tackle 2.0 issues, but only after we get a few steps further and have things working enough that individual changes aren't touching every file in the codebase. I'm sorry I don't have a good answer otherwise, and that we aren't in the position to bring in a new contributor for what would otherwise indeed be a large number of not-very-hard changes. If you're interested in helping with non-translation work, I'd suggest joining the Discord and making yourself known so that we can coordinate adding you to our plans, since the 2.0 project is basically tangled up in ways where the people involved can't just run off and do their own thing. Otherwise, I have to ask you to hold off.

LevFendi commented 1 month ago

@christopherpross Thank you for your interest. Like ahicks has said, we would appreciate your assistance in editing the codebase when it is back to being available for it, which I estimate will be in a few weeks.

In the meantime, we would appreciate translations for the strings we have so far, in launcher.cfg and descriptions.cfg. The other cfg files might still change around a little so we want avoid asking people to translate them twice.

ahicks92 commented 1 month ago

descriptions.cfg may change. I'm busy at this exact moment but can clarify that for us later today. I don't think that it will, but I want to check. I forgot about launcher.cfg but that's a good call. @EphDoering can you clarify whether or not launcher.cfg needs significant changes in English still?

christopherpross commented 1 month ago

@ahicks92 and @LevFendi Many thanks for the quick reply. I know a little bit about Lua, but not about the code-base of the mod. I also don't have the confidence to do large refactorings yet. However, if there are small tasks that would be good for a beginner, I would be happy to help. Otherwise, I would wait until you have completed the transition to version 2.0. Of course I can start with a few .cfg files, you just have to tell me which ones are suitable and won't change much in the future.

I'm already on the Discord server and asked about translation options back in May.

ahicks92 commented 1 month ago

Haha. Small changes. We wish. But thanks. The interest is appreciated.