-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix hungarian localization #1112
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,17 +13,17 @@ const locale = { | |
relativeTime: { | ||
future: '%s múlva', | ||
past: '%s', | ||
s: 'néhány másodperc', | ||
m: 'egy perc', | ||
mm: '%d perc', | ||
h: 'egy óra', | ||
hh: '%d óra', | ||
d: 'egy nap', | ||
dd: '%d nap', | ||
M: 'egy hónap', | ||
MM: '%d hónap', | ||
y: 'egy éve', | ||
yy: '%d év' | ||
s: (_, s, ___, isFuture) => `néhány másodperc${isFuture || s ? '' : 'e'}`, | ||
m: (_, s, ___, isFuture) => `egy perc${isFuture || s ? '' : 'e'}`, | ||
mm: (n, s, ___, isFuture) => `${n} perc${isFuture || s ? '' : 'e'}`, | ||
h: (_, s, ___, isFuture) => `egy ${isFuture || s ? 'óra' : 'órája'}`, | ||
hh: (n, s, ___, isFuture) => `${n} ${isFuture || s ? 'óra' : 'órája'}`, | ||
d: (_, s, ___, isFuture) => `egy ${isFuture || s ? 'nap' : 'napja'}`, | ||
dd: (n, s, ___, isFuture) => `${n} ${isFuture || s ? 'nap' : 'napja'}`, | ||
M: (_, s, ___, isFuture) => `egy ${isFuture || s ? 'hónap' : 'hónapja'}`, | ||
MM: (n, s, ___, isFuture) => `${n} ${isFuture || s ? 'hónap' : 'hónapja'}`, | ||
y: (_, s, ___, isFuture) => `egy ${isFuture || s ? 'év' : 'éve'}`, | ||
yy: (n, s, ___, isFuture) => `${n} ${isFuture || s ? 'év' : 'éve'}` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here (move |
||
}, | ||
formats: { | ||
LT: 'H:mm', | ||
|
@@ -38,4 +38,3 @@ const locale = { | |
dayjs.locale(locale, null, true) | ||
|
||
export default locale | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import moment from 'moment' | ||
import dayjs from '../../src' | ||
import relativeTime from '../../src/plugin/relativeTime' | ||
import '../../src/locale/hu' | ||
|
||
dayjs.extend(relativeTime) | ||
|
||
it('RelativeTime: Time from X', () => { | ||
const T = [ | ||
[44.4, 'second'], // a few seconds | ||
[89.5, 'second'], // a minute | ||
[2, 'minute'], // 2 minutes | ||
[43, 'minute'], // 43 minutes | ||
[45, 'minute'], // an hour | ||
[3, 'hour'], // 3 hours | ||
[21, 'hour'], // 21 hours | ||
[1, 'day'], // a day | ||
[3, 'day'], // 3 day | ||
[25, 'day'], // 25 days | ||
[1, 'month'], // a month | ||
[2, 'month'], // 2 month | ||
[10, 'month'], // 10 month | ||
[1, 'year'], // a year | ||
[2, 'year'], // 2 year | ||
[5, 'year'], // 5 year | ||
[18, 'month'] // 2 years | ||
] | ||
|
||
T.forEach((t) => { | ||
dayjs.locale('hu') | ||
moment.locale('hu') | ||
|
||
const dayjsDay = dayjs() | ||
const momentDay = moment() | ||
|
||
const dayjsCompare = dayjs().add(t[0], t[1]) | ||
const momentCompare = moment().add(t[0], t[1]) | ||
|
||
expect(dayjsDay.from(dayjsCompare)).toBe(momentDay.from(momentCompare)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don’t want to nitpick, however, I would remove the double empty lines (keep only one empty line). |
||
|
||
expect(dayjsDay.to(dayjsCompare)).toBe(momentDay.to(momentCompare)) | ||
|
||
expect(dayjsDay.from(dayjsCompare, true)).toBe(momentDay.from(momentCompare, true)) | ||
}) | ||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vassbence, I think that here you could move
év
right afteregy
(just like you did withegy perc(e)
). That would save you another two chars. 😉