Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As I have described in #876 the translation system could be improved with better flexibility in word reordering.
With this code, support for flexible translations can be added with a case by case approach. This change is backwards compatible and should not break existing translations. (As far as I know)
I have provided a sample translation within the default calendar module that solves Finnish language problem with the word order.
If this merge request is accepted, moving from code like this:
to code like this
Would allow translation like this:
to result:
while falling back to old behaviour with the
fallback
option given in the variables.The new translator function checks for the variables object and if it exists, it tries to replace all the variables within the given translation template with ones found in the variables. If the translation template does not contain any variables in curly braces, it checks if there's an fallback option in the variables and uses that to generate the old style translation.
This also fixes the Finnish translation for
RUNNING
events. Instead of saying something like "Ongoing in 5 minutes" like the current translation says, it is fixed to "Ends in 5 minutes" in Finnish.