#2048 - Language string filtration

Identifier #2048
Issue type Feature request or suggestion
Title Language string filtration
Status Completed
Handling member Chris Graham
Addon core
Description Objectives:
a) Allow a higher-level of configurability within language strings,
b) while retaining performance
c) and not making language-specific assumptions about sentence structure via use of inflexible pre-conceived parameterisation strategories
d) and not causing an explosion in the number of language strings translators need to deal with

Allow language packs to include a filter.php file which contains a class like:

class LangFilter_EN extends LangFilter
{
function compile_time($key, $value)
{
...

return $new_value;
}

function run_time($key, $value, $flag)
{
...

return $new_value;
}
}

The compile_time method is called for each string when a language pack file is compiled into the cache.

The run_time method is called for individual run-time lookups, but only if a string has been marked as needing it within the .ini file like...

[runtime_processing]
MISSING_RESOURCE=example

(this says the "MISSING_RESOURCE" string would get extra processing, passing 'example' as the $flag value for it [useful for decentralised per-string configuration])

The language cache will need to store this meta-data efficiently.


The default EN language pack would tackle the following concerns:

1) Translate the British English to American English, if a config option for this was enabled.

2) Replace "tick (check)" and "ticking (checking)" with just the appropriate word for British/American spelling.

3) Fix clunky language around contextual times, such as "Added on Today" -> "Added Today".

4) Replace the word 'resource' with a specific noun such as 'forum topic'.

5) Replace the word 'category' with a specific noun such as 'forum'.

6) Replace the word 'entry' with a specific noun such as 'gallery image'.

7) Replacing of "the software" with the specific configured brand name (usually "Composr").


Cases 4-6 must be handled in PHP as it would be naive to use regular string subtitutions via language string parameters. There is too much grammatical context in different languages to just clump words into compound sentences (gender, tense, etc).



Document this system in the internationalisation tutorials.
Steps to reproduce

Funded? No
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated