This patch adds support for relative time in the form '%d weeks'. It is
by default disabled. To enable it set relativeTimeThreshold for 'w' to
a number (like 4), and optionally lower the 'd' threshold (like 7), so
anything >= 7 days is considered a week, and 4 weeks are considered
a month.
[bugfix] Properly fallback to base locales in array getter (#5459)
It looks like the existing implementation of this feature was pretty
well thought out and correct, the problem was that a compareArray
function was used which was comparing arrays in a rather bizzare
fashion that was not in line with what a "normal person" would expect.
So now the array comparator is correct, and the logic works properly.
The logic works as follows -- the next locale is picked and tried as-is.
If that fails, the code normally tries to chop the last bit (normally
the country designation) and try again. However, if the next array
element has the same or longer prefix as the one to be tried, the
iteration continues. So for example if the array has the sequence
"AA-BB", "AA-CC", "XX-YY"
then first "AA-BB" is tried, then a naive solution would try "AA", but
this one instead checks to see that "AA-CC" is actually more concrete
than "AA", so it tries "AA-CC" next, and only after it fails (if it
fails) it tries "AA", because "XX-YY" does not have "AA" as prefix. So
in the end the following locales are tried in this order (assuming all
fail so the next one is tried):
Joe [Sat, 25 Apr 2020 20:04:33 +0000 (16:04 -0400)]
[feature] Calendar function handles formats only arg (#3666)
* Issue no. 3658 adding overload for single parameter to calendar function
Corrected the formatting on calendarjs unit test file
Corrected autoformatting
* Removed trailing space...
* fixed comment per request
* added helper utils for better type and property checking, updated calendar functionality to properly identify time and formats inputs. added a bunch of unit tests
Colin Dean [Fri, 24 Apr 2020 20:14:43 +0000 (16:14 -0400)]
[locale] eo: Multiple corrections (#5457)
* [locale] eo: Fixes some expressions
Line 12: adding the letter "t" for the months "marto" and "septembro" to distinguish them from "mardo" (=tuesday) and "sep" (=seven)
Lines 20, 21, 22, 38 and 40: correction of some date expressions in which accusative is needed.
Line 46: adding the word "kelkaj" (=some), because "post sekundoj" and "antaŭ sekundoj" don't really make sense.
Lines 48, 50, 52, 54 and 56: adding the word "unu" (=one) because it's about the quantity "1", and not about an indefinite thing.
* [locale] eo: Fixes tests to match new expressions
Adding the letter "t" for the months "marto" and "septembro" to distinguish them from "mardo" (=tuesday) and "sep" (=seven)
Correction of some expressions in which accusative is needed.
Adding the word "kelkaj" (=some), because "post sekundoj" and "antaŭ sekundoj" don't really make sense.
Adding the word "unu" (=one) because it's about the quantity "1", and not about an indefinite thing introduced by the article a/an.
* [locale] eo: Fixes some typos in tests
* [locale] eo: Drops accusative -n from short day name in llll format
Andrej Rypo [Fri, 24 Apr 2020 18:14:26 +0000 (20:14 +0200)]
[locale] sk: Improve future tense (#5206)
"Za" is commonly (and _incorrectly_) used to relatively refer to a moment in the future. This error is mainly influenced by Czech language, which is very similar and most Slovaks will understand it, many times domesticating phrases from Czech language. In Czech, "za" is used, though in Slovak, "o" must be used.
Here are references to both "za" and "o" in the official dictionary of Slovak language:
https://slovnik.juls.savba.sk/?w=o&s=exact&d=kssj4
https://slovnik.juls.savba.sk/?w=za&s=exact&d=kssj4
And here is a more readable unofficial explanation: https://www.pravopisne.sk/o-hodinu-x-za-hodinu/
[bugfix] Use __dirname for locale import if available
React native doesn't like relative require calls. So use __dirname and
replace relative requires with absolute ones. Fall back to relative
require if __dirname is not present (for whatever reason).
Petar Petrov [Fri, 24 Apr 2020 11:23:12 +0000 (14:23 +0300)]
[locale] Tweak bg translation for last week (#5006)
* Tweak bg translation for last week
The current translation adds a very specific and mostly unnecessary 'at' in the beginning. It just looks/sounds wrong. Maybe there are cases when this might be correct but surely not most of the time. [insert 'change my mind' meme]
Months should be in the accusative case in these formats, but they are
returned in the nominative case. This is because these formats hard-code
the dot after the day ("D.") rather than using ordinal notation ("Do").
The regex for detecting accusative case matches "Do" but not "D.".
Many other locales have the same problem, with L* formats using "D."
where "Do" should be used instead, but none of them have different
grammatical forms for months, so nothing breaks for them. Croatian is
the only one where "D." causes this bug.
Downstream bug report from Wikipedia: https://phabricator.wikimedia.org/T223988
Vinay Date [Mon, 11 Feb 2019 22:57:06 +0000 (04:27 +0530)]
[locale] mr (Marathi) (#4990)
* tests according to changes in mr.js
* [locale] mr (Marathi)
We Marathi people follow standards mentioned below, to label timespans.
Label | Time Span
------------ | -------------
पहाटे (post midnight, pre-sunrise) | >= 12am to < 6am
सकाळी (post sunrise, pre-noon) | >= 6am to < 12pm
दुपारी (afternoon) | >= 12pm to < 5pm
सायंकाळी (evening) | >= 5pm to < 8pm
रात्री (night) | >= 8pm to < 12am
Actually, 12am is confusing in Marathi tradition. In modern clock system, Moment 12am is considered in arriving date as 0am. And in Marathi tradition it is referred to as final moment of the previous date (Sort of, 0:01 is starting minute of the arriving date) . To comply with modern clock system, I propose to refer to 0am as पहाटे , so that it is considered as moment in the arriving date. Hope this discription itself is not confusing :)
Another point is about range of पहाटे, ie. >= 0am to < 6am. Though conventionally, upto 2 am, we refer to the time as रात्री or पहाटे, both alternatively, I want to specifically call पहाटे for early times in the arriving date and रात्री for late times in the departing date, to make it more specific and well-defined, avoiding confusion about date of the time.