Not optimal, but probably more adaptable is just using a centralized string resource. For this scenario, there would be two different entries that handles present and past event.
There's a lot of different libraries and options, but the simplest option is that you put all your static text into a resource file, your code references Resource.SaveToCameraRoll which has the value "Saved to Camera Roll". You have a Norwegian resource file resource-no with the value "Lagret i kamerarullen", and then your application decides whether to load the 'en' or 'no' file.
This has the advantage that you can write up all your static text in English first, and then hand that one file off to a translator and they just give you a file back.
Personally I often actually have my API layer serve up entirely different pages for localisation, because I might want to show different content or layouts for different languages, but that's a lot more work.
There are a lot of ways languages add various post fixes and prefixes.
Typically your i18n lib would want you to give it all the information around past tense etc.... And translate the whole sentence at a time with variables. Not translate one word with a conditional past tense ending right in the middle of it.
The way this is done is almost surely going to translate poorly or not at all
It really ought to be something you do first (if you're ever going to do it all), because it can be an absolute pain to crowbar in after the fact.
If you already build your workflow such that static text lives in a resource file (even if you don't bother actually doing any transforms at the start), it'll be a whole lot easier than trying to peck through all the places where text might appear in your application.
I used to do internationalisation even in internal apps that would only ever be used in English and by five people. I never added the other languages, but the ability was there.
If you expressed that in my company you’d probably be fired. There is an enormous market of non English speaking customers that will purchase from your competitors if you can’t be bothered. The marginal cost to support other locales is tiny compared to the potential revenue. We localize into 20 something languages.
I mean it’s also just written badly, anyone scrolling past stuff like this will have to stop and read, even if only for a second, just to understand what exactly is happening. Which is sorta the opposite of what you want in a declarative language.
I've seen UIs where a button is also a status message. So when the "save" button is clicked, a short time later it is updated to indicate that the save operation is complete (and I guess the button is disabled).
Not saying it's a good UI design, but it's not unprecedented.
219
u/Stummi Sep 28 '26
after it went through i18n:
Good luck with that, translators
116
u/kshetriiiiiiiiii Sep 28 '26
This is the kind of code that passes code review on a Friday afternoon at 4:55 PM
26
u/Last8Exile Sep 28 '26 edited Sep 28 '26 •
l10n, n8n, i18n, a9n...
I f5g h2e t2s n6n!
13
u/Prudhvi2pac Sep 28 '26
13
u/Batroni Sep 28 '26
For somone never done i18n, what should be the optimal way?
12
u/EdelWhite Sep 29 '26
Translations usually come DEAD last in my list of priorities, even in a country with multiple official languages.
Internationalization is not even a thing I'm considering, ever.
If you can't use english, use another software.
(and I'm not a native english speaker, just so hurrdurrs don't call me a silly 'murrican)
2
u/HelloImMay Sep 28 '26
SwiftUI be like:
1
u/muralikbk Sep 30 '26
Review comment: missing the “?” at the end for when the file isn’t saved.
78
u/[deleted] Sep 28 '26
[removed] — view removed comment
1
u/[deleted] Sep 29 '26
[removed] — view removed comment