-
Notifications
You must be signed in to change notification settings - Fork 0
Internationalization
Given that:
- Internationalization is important for accessibility and hence for SP
- It is usually faster to develop apps without multi-language support
- Adding multi-language at a later time often requires rewriting a lot of code and hunting for stray strings
then it would be great if SP had an easy way to allow adding multi-language support on apps that were not designed for it.
A partial solution to this requirement could be to have a way to replace hard-coded Text according to language baked in directly in the compiler.
For example, we could have a way to tag a Text as "to be internationalized", then the system could expose a function to load a new translation and automatically replace all flagged Text (and output a list of missing tags and unused tags).
The flag could also contain metadata about contextual information that could be useful for translations.
--> Problem: how do we make clear that a flagged Text is actually used as a tag and therefore should not be modified? --> Or: what happens when a flagged text is changed and we lose reference to all its translations?
--> Also, this goes against SP's "no mutable state" guarantee and breaks referential transparency.
(Which does not solve the referential transparency problem)
-
flag a string as NOT needing translation
----> How? Single quotes for non-translated strings? Then what do we use for constructors?
-
for any module for any definition for any string provide translation ----> What about duplicate strings in the same definition? Just translate them the same?
-
A translation is for a whole string interpolation, so that interpolated variables can be used in different order