-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[l10n] Add Basque (eu) locale and improve Spanish (es-ES) locale #10819
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
006f643
Add date picker basque i18n.
e74f49d
Apply code format.
e501cbf
Export euES locale in index.ts.
8d2d2ce
Add euES to export interfaces.
98176a5
Add Basque to localeNames.
9b9f158
Fix some Spanish translations and add translation for fieldClearLabel.
adff83c
Fix some Basque translations and add translation for fieldClearLabel.
5587c09
Update stats.
cbc01a1
Remove country specificity
LukasTy 982d708
Make `l10n` work with only language (2 letters) locales
LukasTy 3e3b16c
Fix l10n script to correctly work with 2 letter locale
LukasTy 58ce7f6
Remove debug console
LukasTy 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
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
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,87 @@ | ||
import { PickersLocaleText } from './utils/pickersLocaleTextApi'; | ||
import { getPickersLocalization } from './utils/getPickersLocalization'; | ||
import { TimeViewWithMeridiem } from '../internals/models'; | ||
|
||
const views: Record<TimeViewWithMeridiem, string> = { | ||
hours: 'orduak', | ||
minutes: 'minutuak', | ||
seconds: 'segunduak', | ||
meridiem: 'meridianoa', | ||
}; | ||
|
||
const euESPickers: Partial<PickersLocaleText<any>> = { | ||
// Calendar navigation | ||
previousMonth: 'Azken hilabetea', | ||
nextMonth: 'Hurrengo hilabetea', | ||
|
||
// View navigation | ||
openPreviousView: 'azken bista ireki', | ||
openNextView: 'hurrengo bista ireki', | ||
calendarViewSwitchingButtonAriaLabel: (view) => | ||
view === 'year' | ||
? 'urteko bista irekita dago, aldatu egutegi bistara' | ||
: 'egutegi bista irekita dago, aldatu urteko bistara', | ||
|
||
// DateRange placeholders | ||
start: 'Hasi', | ||
end: 'Bukatu', | ||
|
||
// Action bar | ||
cancelButtonLabel: 'Utxi', | ||
clearButtonLabel: 'Garbitu', | ||
okButtonLabel: 'OK', | ||
todayButtonLabel: 'Gaur', | ||
|
||
// Toolbar titles | ||
datePickerToolbarTitle: 'Data aukeratu', | ||
dateTimePickerToolbarTitle: 'Data eta ordua aukeratu', | ||
timePickerToolbarTitle: 'Ordua aukeratu', | ||
dateRangePickerToolbarTitle: 'Data tartea aukeratu', | ||
|
||
// Clock labels | ||
clockLabelText: (view, time, adapter) => | ||
`Aukeratu ${views[view]}. ${ | ||
time === null | ||
? 'Ez da ordurik aukertau' | ||
: `Aukeratutako ordua ${adapter.format(time, 'fullTime')} da` | ||
}`, | ||
hoursClockNumberText: (hours) => `${hours} ordu`, | ||
minutesClockNumberText: (minutes) => `${minutes} minutu`, | ||
secondsClockNumberText: (seconds) => `${seconds} segundu`, | ||
|
||
// Digital clock labels | ||
selectViewText: (view) => `Aukeratu ${views[view]}`, | ||
|
||
// Calendar labels | ||
calendarWeekNumberHeaderLabel: 'Astea zenbakia', | ||
calendarWeekNumberHeaderText: '#', | ||
calendarWeekNumberAriaLabelText: (weekNumber) => `${weekNumber} astea`, | ||
calendarWeekNumberText: (weekNumber) => `${weekNumber}`, | ||
|
||
// Open picker labels | ||
openDatePickerDialogue: (value, utils) => | ||
value !== null && utils.isValid(value) | ||
? `Data aukeratu, aukeratutako data ${utils.format(value, 'fullDate')} da` | ||
: 'Data aukeratu', | ||
openTimePickerDialogue: (value, utils) => | ||
value !== null && utils.isValid(value) | ||
? `Ordua aukeratu, aukeratutako ordua ${utils.format(value, 'fullTime')} da` | ||
: 'Ordua aukeratu', | ||
fieldClearLabel: 'Balioa garbitu', | ||
|
||
// Table labels | ||
timeTableLabel: 'ordua aukeratu', | ||
dateTableLabel: 'data aukeratu', | ||
|
||
// Field section placeholders | ||
fieldYearPlaceholder: (params) => 'Y'.repeat(params.digitAmount), | ||
fieldMonthPlaceholder: (params) => (params.contentType === 'letter' ? 'MMMM' : 'MM'), | ||
fieldDayPlaceholder: () => 'DD', | ||
fieldWeekDayPlaceholder: (params) => (params.contentType === 'letter' ? 'EEEE' : 'EE'), | ||
fieldHoursPlaceholder: () => 'hh', | ||
fieldMinutesPlaceholder: () => 'mm', | ||
fieldSecondsPlaceholder: () => 'ss', | ||
fieldMeridiemPlaceholder: () => 'aa', | ||
}; | ||
|
||
export const euES = getPickersLocalization(euESPickers); |
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
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
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
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
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.
Should we shorten it? e.g. Chocobozzz/PeerTube#3956
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.
Thank you. That's a very good point and valuable discussion
@lajtomekadimon Could you confirm your position on this topic? Do you agree that having only
eu
as a locale name makes sense?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.
Both "eu" and "eu-ES" are fine as identifiers for the language, but I don't think
eu
alone is a good idea in our case.euES
is the right choice here, mainly because that's the same criteria applied for the other languages.All locale codes of
packages/x-date-pickers/src/locales/
have both the language code and the country code. You haveenUS
instead ofen
for English,esES
instead ofes
for Spanish, etc. Even languages like Icelandic or Japanese, which are only spoken on one country (at least to my knowledge), areisIS
andjaJP
.I can't see the reason why Basque must be an exception and have a neutral country code.
And if that is not enough reason, keep in mind that a locale represents regional settings. It's much more than a language: it includes how numbers, dates and times are display, among other things.
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.
I see your points and they do make sense.
However, have you read the linked discussion? There are some compelling reasons and examples as to why only using
eu
for this and some other locales makes sense. 🤔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.
Yes, I've read it. But that makes sense only if you apply the same criteria to all languages.
I'm not sure if changing the policy of all locale codes is related to this PR. I think that should be addressed on its own issue, since that affects all languages, right?
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.
@LukasTy I wonder if there are this many, e.g.
ja
yes,en
no,fr
no,es
no,de
no.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.
@oliviertassinari If we follow the path that
DateFns
,Dayjs
andMoment
went, then all your mentioned examples are actuallyyes
, because they went withfr
for French (French), but add the country specific suffix for different locales.It would especially make sense if we go the "inheritance"/"alias" route, where
frCH
implementation would be:WDYT? 🤔
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.
@LukasTy Alright, here is my clearer take on it. The root of the problem here is this:
a. If we use
eu_ES
andeu_FR
it would be confusing because these are the sameb. If we only use
eu_ES
, it could be seen as unfair for people living in Francec. If we only use
eu
, it could be seen as an exception to the ruleOverall, I think c. is the way, under the rule that we precise locales as much as possible but without being too precise when it could lead to confusion. This case is rare.
Then there are other cases:
en
is. I wouldn't use this. I think that the only value ofen
is to help people who are short in time, who don't have the bandwidth to support too many locales, to know what's the best approximation (most popular locale).My #suggestion would go like this:
en
as an alias ofen-US
en-UK
, to have it as an extension ofen-US
es-ES
,fr-FR
, etc.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.
I agree about the clarity aspect, but I feel that's what the libraries have addressed by adding a comment about the exact locale specifics, like in this case: https://github.com/date-fns/date-fns/blob/main/src/locale/pt-BR/index.ts#L11
I feel that having the comments would benefit our localization files even in this state to further increase the clarity. 🤔
This comment ties into the 3rd point as well.
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.
@LukasTy I think that the problem is that this is not clear from the codebase of developers. They have to open the docs or look at the IntelliSense.