Carbon: [Translation tool] sl_SI

Created on 14 Aug 2019  路  22Comments  路  Source: briannesbitt/Carbon

|English|sl_SI|comments|
|--|--|--|
|1 hour|1 uro|This should be "1 ura". If you want to say "1 hour till arrival" then you would use "1 ura", but if you want to say "This took me 1 hour to complete" then "1 uro" is correct. But I think mostly the first example applies so "1 ura" would be better...|
|an hour|1 uro|This should be "1 ura". If you want to say "1 hour till arrival" then you would use "1 ura", but if you want to say "This took me 1 hour to complete" then "1 uro" is correct. But I think mostly the first example applies so "1 ura" would be better...|
|1 minute|1 minuto|This is the same as with the hours. If you say "Only 1 minute left" then you use "1 minuta", but if you say "We're going in 1 minute" then you use "1 minuto".|
|a minute|1 minuto|This is the same as with the hours. If you say "Only 1 minute left" then you use "1 minuta", but if you say "We're going in 1 minute" then you use "1 minuto".|
|1 second|1 sekundo|The same as hours and minutes|
|a few seconds|1 sekundo|The same as hours and minutes|
|2 hours before|pred 2 uri|This should be "2 uri pred" if you want to use it in a sentence like "2 hours before the accident", but if you just say "2 hours before" then you use "pred 2 urama" (but it would be even better to use a word instead of number "pred dvema urama") Because grammar...
|2 hours after|膷ez 2 uri|This should be "2 uri po" if you want to use it in a sentence like "2 hours after the accident", but if you just say "2 hours after" then you use "po 2 urah" (but even prettier would be to use a word "po dveh urah") Because grammar...

translation

All 22 comments

Hi @Lovro1107, thanks for your help.

Changes for [time] after/before seems legit. But other should be untouched, by default it would more likely be used as:

Duration: 1 uro

If the user want to put it in a sentence, he/she has to handle the declension as we can't know the context and should provide the more neutral form rather than guessing.

We already handle declensions in "ago" sentence:
https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Lang/sl.php#L45

If we need declensions too for after/before/from_now, we can add them but we should keep the units without declension.

@Lovro1107 Are uro/uri/ure/ur OK for from_now sentences? And in after/before assuming I change them for [time] pred and [time] po?

@Glavic @morpheus7CS Are you OK to replace:

'after' => '膷ez :time',
'before' => 'pred :time',

with:

'after' => ':time po',
'before' => ':time pred',

Or is it something else to consider?

Hey,

Slovene transltions are tricky that way. Let me go through the context explanation you have provided again tomorrow, and fix what needs fixing.

Kind regards,
g

So, I managed to check today. Working off @kylekatarnls's example for the duration, I actually had to change the other values to be in accordance.

Before I do the final PR for this, I do need some more context on this section:

'year_ago' => ':count letom|:count leti|:count leti|:count leti',
'month_ago' => ':count mesecem|:count meseci|:count meseci|:count meseci',
'week_ago' => ':count tednom|:count tednoma|:count tedni|:count tedni',
'day_ago' => ':count dnem|:count dnevoma|:count dnevi|:count dnevi',
'hour_ago' => ':count uro|:count urama|:count urami|:count urami',
'minute_ago' => ':count minuto|:count minutama|:count minutami|:count minutami',
'second_ago' => ':count sekundo|:count sekundama|:count sekundami|:count sekundami',

I'm guessing the intended example in English would be:

Published: 1 year ago

That would mean that the word 'pred' would need to be added for each of these cases.

Is that correct, @kylekatarnls? If yes, let me push another commit to this branch before merging it into master.

Kind regards,
g

No, if you add "pred", it will appear twice. As we have 'ago' => 'pred :time' we'll first try to replace :time with 'year_ago', then if it does not exist, with 'year'

And in fact as there is no short units (y, m, d, etc.) we will also have to add y_ago, m_ago, etc.

OK, currently the PR will fail on tests. Here's the problem: the test cases do put 'pred' in front. The output is correct in this context:

Duration: 1 sekunda

but it is not correct in this case (notice the change from sekunda to sekundo, due to the addition of pred):

Published: pred 1 sekundo

Any ideas on how to solve it?

Kind regards,
g

OK, I think I got it. Will have to rewrite all the test cases, but it will work for both cases.

We would need to change the format of:

'ago' => 'pred :time',
'from_now' => '膷ez :time',

to:

'ago' => ':time nazaj',
'from_now' => ':time kasneje',

That would mean the change would cover both output options as this structure doesn't change the declination of time units.

@Lovro1107, @Glavic - do you think that would be OK?

Kind regards,
g

@morpheus7CS Yes, when changing translations, we assume previous ones were wrong, so we "broke" tests and rewrite it. Then we can see real output and check if it's what we really expect.

I will make tests pass using your change proposal then dump here the difference in a table. So new translation results could be checked in a human-friendly way.

Great.

I'll be on standby :)

Kind regards,
g

Here are the changes in unit tests:

| English | Before | After |
|--|--|--|
| 2s ago | pred 2 sekundi | pred 2 sekundama |
| 2m ago | pred 2 minuti | pred 2 minutama |
| 2h ago | pred 2 uri | pred 2 urama |
| 1d ago | pred 1 dan | pred 1 dnem |
| 2d ago | pred 2 dni | pred 2 dnevoma |
| 1w ago | pred 1 teden | pred 1 tednom |
| 2w ago | pred 2 tedna | pred 2 tednoma |
| 1mo ago | pred 1 mesec | pred 1 mesecem |
| 2mos ago | pred 2 meseca | pred 2 meseci |
| 1yr ago | pred 1 leto | pred 1 letom |
| 1 second from now | 膷ez 1 sekundo | 膷ez 1 sekunda |
| 1s from now | 膷ez 1 sekundo | 膷ez 1 sekunda |
| 1 second after | 膷ez 1 sekundo | 1 sekunda kasneje |
| 1s after | 膷ez 1 sekundo | 1 sekunda kasneje |
| 1 second before | pred 1 sekundo | 1 sekunda prej |
| 1s before | pred 1 sekundo | 1 sekunda prej |
| 1 second | 1 sekundo | 1 sekunda |
| 1s | 1 sekundo | 1 sekunda |
| 1s from now | 膷ez 1 sekundo | 膷ez 1 sekunda |
| 1 minute 1 second | 1 minuto 1 sekundo | 1 minuta 1 sekunda |
| 2yrs 3mos 1d 1s | 2 leti 3 mesece 1 dan 1 sekundo | 2 leti 3 mesece 1 dan 1 sekunda |
| 5mos ago | pred 5 mesecev | pred 5 meseci |
| 2yrs 3mos 1d 1s ago | pred 2 leti 3 mesece 1 dan 1 sekundo | pred 2 leti 3 meseci 1 dnem 1 sekundo |
| 2 weeks 1 hour | 2 tedna 1 uro | 2 tedna 1 ura |
| an hour from now | 膷ez 1 uro | 膷ez 1 ura |

Is it alright?

If I'm right, there is only 1 wrong line:

| 2yrs 3mos 1d 1s ago | pred 2 leti 3 mesece 1 dan 1 sekundo | pred 2 leti 3 mesece 1 dan 1 sekunda |
|--|--|--|

It seems like only the first unit has the declension. But it sounds like a global problem. It may occur on other languages with similar declensions.

Table updated.

Hey @kylekatarnls,

so in your table, there are a few cases where the before is more grammatically correct then the after. Concretely:

  • 1 second from now / 1s from now (we're actually testing this three times in the table)
  • an hour from now

The trouble is declination of the word sekunda. I don't know if Carbon supports specific instances, where one word can have a different declination structure, depending on if it is used on its own or in the ago/before structures.

Additionally, I have gone through the examples provided for 1 second after / 1s after case. Is the intended use case in this sentence structure:

1 second before <some event>

If yes, I would agree to switch out the kasneje in favor po and that will make it more grammatically correct.

Kind regards,
g

Why would it be 膷ez 1 sekundo and 膷ez 1 uro if declension is only for "ago". If it's not please give me the exact rule: when to use which declension?

Yes 1 second before <some event> is a common case. Does "po" goes after or before the duration?

I got the answer in CLDR 馃挕 it's only for 1 quantities. But in this case we need to add the _from_now keys for each unit.

1 second before could then become :time po and that would work with for all current use cases.

I'll try to explain the rest to the best of my ability. Slovene declension has a lot of special cases.

1 second => 1 sekunda
1 second from now => 膷ez 1 sekundo
1 hour => 1 ura
1 hour from now => 膷ez 1 uro

But if you have a number higher then 1, the difference vanishes completely.

2 seconds => 2 sekundi
2 second from now => 膷ez 2 sekundi
2 hours => 2 uri
2 hour from now => 膷ez 2 uri

Additionally, you have the different declension for not just 1, 2, 3 and many, but also special cases in between. For example

1 second  => 1 sekunda
2 seconds => 2 sekundi
3 seconds => 3 sekunde
4 seconds => 4 sekunde
5 seconds => 5 sekund
...
same format until 101
...
101 seconds => 101 sekunda (same as the case for 1)
102 seconds => 102 sekundi (same as the case for 2)

I hope I managed to illustrate the issue a little better.

Kind regards,
g

Here is the plan:

    'second' => ':count sekunda|:count sekundi|:count sekunde|:count sekund',
    'second_ago' => ':count sekundo|:count sekundama|:count sekundami|:count sekundami',
    'second_from_now' => ':count sekundo|:count sekundi|:count sekunde|:count sekund',

And same for hour/minute.

About the plural, we rely on Symfony: https://github.com/symfony/translation/blob/4.4/PluralizationRules.php#L168

Last thing:

1 second before could then become :time po and that would work with for all current use cases.

Previously you said:

switch out the kasneje in favor po

But kasneje is currently for after not for before.

I never knew second_ago and second_from_now existed! This will likely solve all of the test cases.

Great work, thanks @kylekatarnls.

Kind regards,
g

@morpheus7CS I also found short units in CLDR, can you confirm the following can be understood in Slovenian:

2 mes. 1 ted. 4 dan 3 h 32 min. 15 s

Understood completely.

Thanks,
g

Testable with 2.24.0-beta.3

It will be released next week in 2.24.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ManojKiranA picture ManojKiranA  路  4Comments

dboyadzhiev picture dboyadzhiev  路  4Comments

mrcnpdlk picture mrcnpdlk  路  4Comments

rohstar picture rohstar  路  4Comments

scs-ben picture scs-ben  路  3Comments