Firefox PHP

Language: Slovak (5.2.9a)

Posted by Martin Sereday 
All files from this thread

File Name File Size   Posted by Date  
slovak529+mods.zip 12.7 KB open | download Martin Sereday 11/17/2008 Read message
Language: Slovak (5.2.9a)
November 17, 2008 08:47AM
Here is the Slovak translation of v.5.2.9a.
However, there is a gramar problem in some plural expressions. In almost all of eastern (Slavian) languages there is a special rule for singular and plurals.

1 day = singular (this is OK)
2,3,4 days = plural_1 (this is also OK)
but
5+ days = plural_2 (this is missing

It would be nice to extend these definitions in all occurencies to the expression would correspond with local gramar rules.

This can be made by setting expression in language files and additional conditioins in other scritps e.g.:

if "something" = 1 -> "somethuing_singular"
if "something">1 and "something:<5 -> "something_plural_1"
if "something">5 and "s -> "something_plural_2" // would be used the same expression like "something_plural_1"

E.g. (Slovak):

1 year, month, day, user etc. = 1 rok, mesiac, deň, užívateľ, etc.
2,3,4 years, months, days, users = 2 roky, mesiace, dni, užívatelia, etc.
...
5+ years, months, days, users = 5 rokov, mesiacov, dní, užívateľov etc.

It's better to get someone to angle than to angle to give him a fish.
Attachments:
open | download - slovak529+mods.zip (12.7 KB)
Re: Language: Slovak (5.2.9a)
November 17, 2008 08:59AM
The problem with that approach is that it would be strictly linked to 5-and-more. There are other languages in which other rules apply and where the break would be at 3-and-more. So hard-coding it like this would be a bad idea.

I have used a method in some of my modules, to be able to supply a specific language string for a specific number. For example, if the language key is "something", then one could have things like this in the language file:
    'something_0' => 'None available',
    'something_1' => 'There can be only one!',
    'something_3' => 'Henry the third',
    'something_4' => 'This is entry number %number%',
    'something'   => 'And we have %number%'

This method would make it fully flexible and it is backward compatible with the existing language files. So I would propose this method to handle number specific language strings.

I created ticket #820 for this. Don't expect it to be done overnight, but we will get to it.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 1 time(s). Last edit at 11/17/2008 08:59AM by Maurice Makaay.
Re: Language: Slovak (5.2.9a)
November 17, 2008 06:39PM
After snal research in a couple of languages I found that there are on 99% only two forms of plurals. It's true that these are not used at the same number in general. But this could be solved with one more variable in native configuration. E.g. for Czech, Slovak, Poland and almost all eastern languages:
Plural_2_Limit = "5";

Then somewhere in the code would be the condition:

if something = 1
use Something_Singular
else if something > 1 and something < Plural_2_Limit
use Something_Plural_1
else use Something_Plural_2

This would be the most flexible condition for almost any language IMHO.
Re: Language: Slovak (5.2.9a)
November 17, 2008 07:33PM
That's too lot of a hassle and not really intuitive IMO. Note that we try to prevent the use of function calls when we can avoid it in the code. Your solution would defenitely require a function call. For doing handling of multiple plural forms, I would think that this kind of logic fits Phorum a lot more:

Language: PHP
$count = 3; // some value on which the string has to be based $str = isset($PHORUM['DATA']['LANG']["langkey_$count"]) ? $PHORUM['DATA']['LANG']["langkey_$count"] : $PHORUM['DATA']['LANG']['langkey'];

I am aware that this would lead to duplicate entries in the language file for your language (2, 3 and 4). I guess that a bit of script at the bottom of the language file could accomodate for creating the copies for you. It would be cumbersome to have to create and maintain those copies yourself. Something like:

Language: PHP
foreach (array('langkey1', 'langkey2', ...'langkeyn') as $key) { $PHORUM['DATA']['LANG']["$key_3"] = $PHORUM['DATA']['LANG']["$key_4"] = $PHORUM['DATA']['LANG']["$key_2"]; }


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Language: Slovak (5.2.9a)
June 01, 2010 08:36AM
I installed the Phorum successfully. One small thing occured. After openning the admin area I have these warnings:

Quote
admin.php
Warning: Division by zero in D:\wamp\www\pluginstest\phorum\include\lang\slovak.php on line 175
Warning: Division by zero in D:\wamp\www\pluginstest\phorum\include\lang\slovak.php on line 175
Warning: Division by zero in D:\wamp\www\pluginstest\phorum\include\lang\slovak.php on line 385
Warning: Division by zero in D:\wamp\www\pluginstest\phorum\include\lang\slovak.php on line 385
In these two lines there are variables: "%name%" and "%recipient%".

Is this serious? And what is the reason? How to fix this?
Sorry, only registered users may post in this forum.

Click here to login