Even if it possible to translate some strings with variable (example: Hello {$username}{/tr} with in language.php file "Hello {\$username}"=>"Bonjour {\$username}", all configurations are not possible.
For instance "Hello {$title} {$username}{/tr}". ($title needs a translation, not $username).
List of other products with similar/interesting/related features.
Here I would like to see some "editorial" content. How do our features compare to others?
This is where new features being developed and only in CVS are documented. When the CVS becomes RC/official release, the info in the CVS docs is transferred to update the official docs (FeatureXDoc).
mose said :the language.php is so heavy that it's one reason we need huge amount of memory for tiki. (sylvie: 228KB .... is it really bigcompared to the 5MB - but optimization is everywhere) Maybe that file cane be regenerated by admin with only the selected options translated, to a language_light.php. That would imply to declare somewhere the list of tpl for each feature, but imho it's not so a huge work when that first step is done.
Chealer9 adds :
I was not aware of this issue. Here's an idea this gave me. I'm highly unsure about it and would like your comments. I am Not proposing myself for this, it's just a brain game.
Well, I had more ideas since, I'll write it in steps so it's easier to follow.
Here are associated advantages :
Assuming someone codes this 🙄 it would leave three problems :
I realize this is not really a Tiki only thing, maybe others already have something like that...Smarty? At least, if not then coding it could probably be contributed to Smarty. Also, I totally forgot about PHP's tra() while writing this and I just hope it can still work with that. This can really contain errors, feel free to correct me.
Update : I attached a discussion I had at #smarty with other devs. One talked about gettext, I wonder if we can use it optionally. It was supposed to be useful for all those advantages except context.
Update 2 : Sylvie came with a link to Smarty gettext today on IRC without much feedback, but it sounds good 😊
Update3 : sylvie: In 1.9 I took away a couple of include(language.php). Now (I think) the include is done only when it is really necessary. If the tpl files are precompiled, the include(language.php) is only done by the tra calls.
=> to optimize the perf:
The creation of the language_tra.php can be done when you compile all the tpls.
As we see on i18n status, many translations are incomplete. I have in mind two patches submitted to SourceForge, one proposing Ukrainian with 30% completion, the other proposing Korean with 10% completion. I hesitate to include those, since Tiki's default lang folder already eats about 4 MB, and those languages are not even complete.
Why not add something to the release script that would remove untouched strings from (incomplete) language.php-s? The package's size would be reduced, but also the memory consumption of those languages. This sounds quite easy to code, and it would make include partial translations much more reasonable to consider.
Chealer9
What about the question that Isam Bayazidi posed about RTL languages, ones that are read right-to-left, and the benefit of right justification? He wanted a bi-lingual site, i.e. Arabic and English. — UserPagejcwinnie 2004-May-17 -
The following mechanism (or something very similar) is used in most popular operating systems - it could be added to Tiki with minimal impact on the Tiki environment.
default text{/tr}
Either token or default text must be supplied. Supplying both is acceptable.
Spaces may only appear in <value>
Alternative tokens are seperated by '/'.
The '?' character in a token in the file matches any character in the same position in the token supplied to be matched.
Case is significant.
The actions to find a match for a token are:
Note: there is no attempt to check the default language file. It is expected that the default text will always be supplied
Initially the extended features of tr would only be used for text labels and button text. The token always begins with:
token | description |
button. | for button text |
label. | for label text |
Examples: button.edit label.user_flip_modules
Whenever you use Users can Shade Modules:{/tr}
get_strings.php would need to be extended to understand the new syntax and do the right thing.
- to be able to specify the context af a translation.
The other I had in the chart feature "perm" that is not perms but the abbreviation of "permancency"
- to optimize the access to the tra strings sylvie
string{/tr}
the context will be added by each translator each time he has some problem. For an abbreviation it will be the complete string. For a table header, it will be the indication "header".
get_strings will have to create the lines
//"context#string" => "translatedstring"
The translator can uncomment the line and adds his translation if needed sylvie
For the optimisation I propose to compile the remaining strings in a (md5, translatedstring) to speed the process. sylvie
^
IrcHook