-
Notifications
You must be signed in to change notification settings - Fork 4
Translation script: Fix incorrect multiline matches #15
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
base: main
Are you sure you want to change the base?
Conversation
…ings Prevously, the translation update script would match 'if not input:find("%S") then' because 'S"' is a valid function call expression. This commit addresses that by only matching single lines. Whereas that's a workaround, it does work well. --> Tested on luanti/builtin This furthermore adds the option '--discard-empty' which omits empty translation strings from all files but template.txt.
I am confused: Either way the problem is that we start matching inside a string, no? The only real way to combat that is to keep track of tokens (at least at a string / non-string granularity), then have a regex of Is there ever a situation where we want to allow empty translation strings? (Ultimately this is another problem caused by just throwing regex at this rather than a clean two step approach starting with tokenization... but probably not worth fixing?) |
Yes, that. The code I wrote to fix that is not perfect, but at least gets rid of all false-positives within luanti/builtin.
Yes, but I'm not going to implement that. Regex isn't the best choice here, but it's what we've got, and what works OK in most cases. Feel free to propose code changes.
Modders's choice to provide convenience for the translators. |
Usecase? Empty strings in translation files allow looking for strings that are not yet translated and translating those directly (without cross-referencing the template or adding the missing entries manually). Discarding empty strings brings hardly any gain to speak of in terms of disk space unless many strings are not translated. The argument on disk space/network transfer times is also somewhat paradoxical in itself: the "wasted" space is a result of the lack of translations; this should arguably be improved by actually providing translations for such strings, which has the opposite effect of increasing the size of translations files. (Edit: Clarification) |
Oh! I had misunderstood "empty translation strings" to mean |
Removed the |
Actually there should also be a warning against Footnotes
|
…ings
Prevously, the translation update script would match 'if not input:find("%S") then' because 'S"' is a valid function call expression. This commit addresses that by only matching single lines. Whereas that's a workaround, it does work well. --> Tested on luanti/builtin
This furthermore adds the option '--discard-empty' which omits empty translation strings from all files but template.txt.