mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Droppped momentjs in favor of Intl
Uses a fallback for Intl.RelativeTimeFormat in Date.prototype.fromNow
This commit is contained in:
parent
6f585e1f1d
commit
3bfe2c67d1
17 changed files with 478 additions and 97 deletions
|
|
@ -1071,17 +1071,16 @@ class ServiceActions
|
|||
|
||||
$sLanguage = strtr($sLanguage, '_', '-');
|
||||
|
||||
$sMoment = 'window.moment && window.moment.locale && window.moment.locale(\'en\');';
|
||||
$options = [$sLanguage, \substr($sLanguage, 0, 2)];
|
||||
$sTimeFormat = '';
|
||||
$options = [$sLanguage, \substr($sLanguage, 0, 2), 'en'];
|
||||
foreach ($options as $lang) {
|
||||
$sMomentFileName = APP_VERSION_ROOT_PATH.'app/localization/moment/'.$lang.'.js';
|
||||
if (\is_file($sMomentFileName)) {
|
||||
$sMoment = \file_get_contents($sMomentFileName);
|
||||
$sMoment = \preg_replace('/\/\/[^\n]+\n/', '', $sMoment);
|
||||
$sFileName = APP_VERSION_ROOT_PATH.'app/localization/relativetimeformat/'.$lang.'.json';
|
||||
if (\is_file($sFileName)) {
|
||||
$sTimeFormat = \preg_replace('/^\\s+/', '', \file_get_contents($sFileName));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 'document.documentElement.lang = "'.$sLanguage.'";window.rainloopI18N='.$sResult.';'.$sMoment;
|
||||
return "document.documentElement.lang = '{$sLanguage}';\nwindow.rainloopI18N={$sResult};\nDate.defineRelativeTimeFormat({$sTimeFormat});";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
https://www.transifex.com/rainloop/rainloop-webmail/
|
||||
https://www.transifex.com/rainloop/rainloop-webmail/
|
||||
https://tools.ietf.org/html/bcp47
|
||||
relativetimeformat based on Unicode CLDR
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
|
||||
75
rainloop/v/0.0.0/app/localization/relativetimeformat/de.json
Normal file
75
rainloop/v/0.0.0/app/localization/relativetimeformat/de.json
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
long: {
|
||||
year: {
|
||||
past: {
|
||||
one: "vor {0} Jahr",
|
||||
other: "vor {0} Jahren"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} Jahr",
|
||||
other: "in {0} Jahren"
|
||||
}
|
||||
},
|
||||
month: {
|
||||
past: {
|
||||
one: "vor {0} Monat",
|
||||
other: "vor {0} Monaten"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} Monat",
|
||||
other: "in {0} Monaten"
|
||||
}
|
||||
},
|
||||
week: {
|
||||
past: {
|
||||
one: "vor {0} Woche",
|
||||
other: "vor {0} Wochen"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} Woche",
|
||||
other: "in {0} Wochen"
|
||||
}
|
||||
},
|
||||
day: {
|
||||
past: {
|
||||
one: "vor {0} Tag",
|
||||
other: "vor {0} Tagen"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} Tag",
|
||||
other: "in {0} Tagen"
|
||||
}
|
||||
},
|
||||
hour: {
|
||||
past: {
|
||||
one: "vor {0} Stunde",
|
||||
other: "vor {0} Stunden"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} Stunde",
|
||||
other: "in {0} Stunden"
|
||||
}
|
||||
},
|
||||
minute: {
|
||||
past: {
|
||||
one: "vor {0} Minute",
|
||||
other: "vor {0} Minuten"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} Minute",
|
||||
other: "in {0} Minuten"
|
||||
}
|
||||
},
|
||||
second: {
|
||||
past: {
|
||||
one: "vor {0} Sekunde",
|
||||
other: "vor {0} Sekunden"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} Sekunde",
|
||||
other: "in {0} Sekunden"
|
||||
}
|
||||
}
|
||||
},
|
||||
plural: n => 1 == n ? 'one' : 'other'
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
long: {
|
||||
year: {
|
||||
past: {
|
||||
one: "{0} year ago",
|
||||
other: "{0} years ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} year",
|
||||
other: "in {0} years"
|
||||
}
|
||||
},
|
||||
month: {
|
||||
past: {
|
||||
one: "{0} month ago",
|
||||
other: "{0} months ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} month",
|
||||
other: "in {0} months"
|
||||
}
|
||||
},
|
||||
week: {
|
||||
past: {
|
||||
one: "{0} week ago",
|
||||
other: "{0} weeks ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} week",
|
||||
other: "in {0} weeks"
|
||||
}
|
||||
},
|
||||
day: {
|
||||
past: {
|
||||
one: "{0} day ago",
|
||||
other: "{0} days ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} day",
|
||||
other: "in {0} days"
|
||||
}
|
||||
},
|
||||
hour: {
|
||||
past: {
|
||||
one: "{0} hour ago",
|
||||
other: "{0} hours ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} hour",
|
||||
other: "in {0} hours"
|
||||
}
|
||||
},
|
||||
minute: {
|
||||
past: {
|
||||
one: "{0} minute ago",
|
||||
other: "{0} minutes ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} minute",
|
||||
other: "in {0} minutes"
|
||||
}
|
||||
},
|
||||
second: {
|
||||
past: {
|
||||
one: "{0} second ago",
|
||||
other: "{0} seconds ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} second",
|
||||
other: "in {0} seconds"
|
||||
}
|
||||
}
|
||||
},
|
||||
plural: n => 1 == n ? 'one' : 'other'
|
||||
}
|
||||
76
rainloop/v/0.0.0/app/localization/relativetimeformat/en.json
Normal file
76
rainloop/v/0.0.0/app/localization/relativetimeformat/en.json
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
long: {
|
||||
year: {
|
||||
past: {
|
||||
one: "{0} year ago",
|
||||
other: "{0} years ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} year",
|
||||
other: "in {0} years"
|
||||
}
|
||||
},
|
||||
month: {
|
||||
past: {
|
||||
one: "{0} month ago",
|
||||
other: "{0} months ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} month",
|
||||
other: "in {0} months"
|
||||
}
|
||||
},
|
||||
week: {
|
||||
past: {
|
||||
one: "{0} week ago",
|
||||
other: "{0} weeks ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} week",
|
||||
other: "in {0} weeks"
|
||||
}
|
||||
},
|
||||
day: {
|
||||
past: {
|
||||
one: "{0} day ago",
|
||||
other: "{0} days ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} day",
|
||||
other: "in {0} days"
|
||||
}
|
||||
},
|
||||
hour: {
|
||||
past: {
|
||||
one: "{0} hour ago",
|
||||
other: "{0} hours ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} hour",
|
||||
other: "in {0} hours"
|
||||
}
|
||||
},
|
||||
minute: {
|
||||
past: {
|
||||
one: "{0} minute ago",
|
||||
other: "{0} minutes ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} minute",
|
||||
other: "in {0} minutes"
|
||||
}
|
||||
},
|
||||
second: {
|
||||
past: {
|
||||
one: "{0} second ago",
|
||||
other: "{0} seconds ago"
|
||||
},
|
||||
future: {
|
||||
one: "in {0} second",
|
||||
other: "in {0} seconds"
|
||||
}
|
||||
}
|
||||
},
|
||||
// 'zero', 'one', 'two', 'few', 'many', 'other'
|
||||
plural: n => 1 == n ? 'one' : 'other'
|
||||
}
|
||||
75
rainloop/v/0.0.0/app/localization/relativetimeformat/es.json
Normal file
75
rainloop/v/0.0.0/app/localization/relativetimeformat/es.json
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
long: {
|
||||
year: {
|
||||
past: {
|
||||
one: "hace {0} año",
|
||||
other: "hace {0} años"
|
||||
},
|
||||
future: {
|
||||
one: "dentro de {0} año",
|
||||
other: "dentro de {0} años"
|
||||
}
|
||||
},
|
||||
month: {
|
||||
past: {
|
||||
one: "hace {0} mes",
|
||||
other: "hace {0} meses"
|
||||
},
|
||||
future: {
|
||||
one: "dentro de {0} mes",
|
||||
other: "dentro de {0} meses"
|
||||
}
|
||||
},
|
||||
week: {
|
||||
past: {
|
||||
one: "hace {0} semana",
|
||||
other: "hace {0} semanas"
|
||||
},
|
||||
future: {
|
||||
one: "dentro de {0} semana",
|
||||
other: "dentro de {0} semanas"
|
||||
}
|
||||
},
|
||||
day: {
|
||||
past: {
|
||||
one: "hace {0} día",
|
||||
other: "hace {0} días"
|
||||
},
|
||||
future: {
|
||||
one: "dentro de {0} día",
|
||||
other: "dentro de {0} días"
|
||||
}
|
||||
},
|
||||
hour: {
|
||||
past: {
|
||||
one: "hace {0} hora",
|
||||
other: "hace {0} horas"
|
||||
},
|
||||
future: {
|
||||
one: "dentro de {0} hora",
|
||||
other: "dentro de {0} horas"
|
||||
}
|
||||
},
|
||||
minute: {
|
||||
past: {
|
||||
one: "hace {0} minuto",
|
||||
other: "hace {0} minutos"
|
||||
},
|
||||
future: {
|
||||
one: "dentro de {0} minuto",
|
||||
other: "dentro de {0} minutos"
|
||||
}
|
||||
},
|
||||
second: {
|
||||
past: {
|
||||
one: "hace {0} segundo",
|
||||
other: "hace {0} segundos"
|
||||
},
|
||||
future: {
|
||||
one: "dentro de {0} segundo",
|
||||
other: "dentro de {0} segundos"
|
||||
}
|
||||
}
|
||||
},
|
||||
plural: n => 1 == n ? 'one' : 'other'
|
||||
}
|
||||
69
rainloop/v/0.0.0/app/localization/relativetimeformat/fr.json
Normal file
69
rainloop/v/0.0.0/app/localization/relativetimeformat/fr.json
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
long: {
|
||||
year: {
|
||||
past: {
|
||||
one: "il y a {0} an",
|
||||
other: "il y a {0} ans"
|
||||
},
|
||||
future: {
|
||||
one: "dans {0} an",
|
||||
other: "dans {0} ans"
|
||||
}
|
||||
},
|
||||
month: {
|
||||
past: "il y a {0} mois",
|
||||
future: "dans {0} mois"
|
||||
},
|
||||
week: {
|
||||
past: {
|
||||
one: "il y a {0} semaine",
|
||||
other: "il y a {0} semaines"
|
||||
},
|
||||
future: {
|
||||
one: "dans {0} semaine",
|
||||
other: "dans {0} semaines"
|
||||
}
|
||||
},
|
||||
day: {
|
||||
past: {
|
||||
one: "il y a {0} jour",
|
||||
other: "il y a {0} jours"
|
||||
},
|
||||
future: {
|
||||
one: "dans {0} jour",
|
||||
other: "dans {0} jours"
|
||||
}
|
||||
},
|
||||
hour: {
|
||||
past: {
|
||||
one: "il y a {0} heure",
|
||||
other: "il y a {0} heures"
|
||||
},
|
||||
future: {
|
||||
one: "dans {0} heure",
|
||||
other: "dans {0} heures"
|
||||
}
|
||||
},
|
||||
minute: {
|
||||
past: {
|
||||
one: "il y a {0} minute",
|
||||
other: "il y a {0} minutes"
|
||||
},
|
||||
future: {
|
||||
one: "dans {0} minute",
|
||||
other: "dans {0} minutes"
|
||||
}
|
||||
},
|
||||
second: {
|
||||
past: {
|
||||
one: "il y a {0} seconde",
|
||||
other: "il y a {0} secondes"
|
||||
},
|
||||
future: {
|
||||
one: "dans {0} seconde",
|
||||
other: "dans {0} secondes"
|
||||
}
|
||||
}
|
||||
},
|
||||
plural: n => 1 == n ? 'one' : 'other'
|
||||
}
|
||||
63
rainloop/v/0.0.0/app/localization/relativetimeformat/nl.json
Normal file
63
rainloop/v/0.0.0/app/localization/relativetimeformat/nl.json
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
long: {
|
||||
year: {
|
||||
past: "{0} jaar geleden",
|
||||
future: "over {0} jaar"
|
||||
},
|
||||
month: {
|
||||
past: {
|
||||
one: "{0} maand geleden",
|
||||
other: "{0} maanden geleden"
|
||||
},
|
||||
future: {
|
||||
one: "over {0} maand",
|
||||
other: "over {0} maanden"
|
||||
}
|
||||
},
|
||||
week: {
|
||||
past: {
|
||||
one: "{0} week geleden",
|
||||
other: "{0} weken geleden"
|
||||
},
|
||||
future: {
|
||||
one: "over {0} week",
|
||||
other: "over {0} weken"
|
||||
}
|
||||
},
|
||||
day: {
|
||||
past: {
|
||||
one: "{0} dag geleden",
|
||||
other: "{0} dagen geleden"
|
||||
},
|
||||
future: {
|
||||
one: "over {0} dag",
|
||||
other: "over {0} dagen"
|
||||
}
|
||||
},
|
||||
hour: {
|
||||
past: "{0} uur geleden",
|
||||
future: "over {0} uur"
|
||||
},
|
||||
minute: {
|
||||
past: {
|
||||
one: "{0} minuut geleden",
|
||||
other: "{0} minuten geleden"
|
||||
},
|
||||
future: {
|
||||
one: "over {0} minuut",
|
||||
other: "over {0} minuten"
|
||||
}
|
||||
},
|
||||
second: {
|
||||
past: {
|
||||
one: "{0} seconde geleden",
|
||||
other: "{0} seconden geleden"
|
||||
},
|
||||
future: {
|
||||
one: "over {0} seconde",
|
||||
other: "over {0} seconden"
|
||||
}
|
||||
}
|
||||
},
|
||||
plural: n => 1 == n ? 'one' : 'other'
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue