4 ms·
One idea you might want to consider is to create a global function, let’s call it h() and pass all your human readable strings through it, like so h(“hello worl
by waleedka 8y ago
One idea you might want to consider is to create a global function, let’s call it h() and pass all your human readable strings through it, like so h(“hello world”). This function, simply returns the same string. This is more explicit than relying on quote types. It also allows you to do interesting things such as logging everything to a text file and running a spell checker on it, or checking for wrongly encoded string, ...etc.
- demosito666 8y agoI believe _() would be even better, granted you might want to translate messages in future. At first might just def _(s): return s.
- ComputerGuru 8y agoA single underscore is pretty much de facto reserved for localization.
- jedberg 8y agoWhich is exactly what this is. Putting everything a human reads into a function is step one of localization.
- danpalmer 8y agoYep, as others have commented, this is what I meant by using the translation tools.
- cup-of-tea 8y agoThat's pretty standard in libraries that do i18n (like Qt, for example). It's a very good practice IMO. Not only does it enable i18n, it means you can easily collect every user-destined string and check it for things like forbidden words etc.