siddii / angular-timer

re-usable/inter-operable AngularJS timer directive ⛺
http://siddii.github.io/angular-timer/
MIT License
792 stars 938 forks source link

Plural / Singular units #178

Open thenovacreator opened 9 years ago

thenovacreator commented 9 years ago

I really do not get how your Plural / Singular units System is working. I want for singular "Minute" and for plural "Minuten" and tried:

Minute{{MinutenS}} Minuten{{MinuteS}} Minute{{MinuteN}}

but none of them seems to work. What could i do to get this working? The syntax is very confusing.

Maybe it would be easier if you would use a syntax like so [minute|minutes]. This would ne inspired by http://laravel.com/docs/5.0/localization#pluralization

http://siddii.github.io/angular-timer/index.html#/clock-timer-i18n just don't work!

polomarcus commented 9 years ago

Hi,

Have you tried ?

<timer interval="1000" language="de" >{{yearUnit}}</timer>

It is written here : http://siddii.github.io/angular-timer/index.html#/clock-timer-i18n

thenovacreator commented 9 years ago

Yes this works but not for my usecase.

AaronBuxbaum commented 9 years ago

Does this work? I haven't had a chance to test it, but it isn't one of the examples you've given:

<timer interval="1000" language="de">{{minutes}} minute{{minutesS}}</timer>
keligijus commented 8 years ago

Is there any way to use i18n version, but have days, hours and minutes in separate containers?

I need to style each element separately, and if I use this example:

<timer interval="1000" start-time="1357020000000" language="de" >{{yearUnit}}</timer>

I get this result:

<span class="ng-binding ng-scope">3 Jahre, 18 Tage, 9 Stunden, 14 Minuten, 44 Sekunden</span>

But the desired result:

<span class="ng-binding ng-scope">
  <span>3 Jahre</span>
  <span>18 Tage</span>
  <span>9 Stunden</span>
  <span>14 Minuten</span>
</span>

Is there any way to achieve this?

polomarcus commented 8 years ago

Hi @keligijus :smile:

I guess we could split this value $scope.yearUnit https://github.com/siddii/angular-timer/blob/master/app/js/_timer.js#L236 in :

$scope.yearUnit is built there : https://github.com/siddii/angular-timer/blob/master/app/js/i18nService.js#L53 and generated with https://github.com/EvanHahn/HumanizeDuration.js

Do you think you could provide a PR ?

keligijus commented 8 years ago

Hi @polomarcus :)

I'll try to do my best. If I can figure it out and make it work, will definitely provide a PR