Skip to content

Commit

Permalink
Translations for TagGroup (adobe#6890)
Browse files Browse the repository at this point in the history
* Translations for TagGroup

* add number of tags

* Revert " fix/bug useTablist adobe#5996 (adobe#6023)"

This reverts commit c4a783e.

* Revert "Extract `ToggleStateProps` type to use only what is needed in `useToggleState` (adobe#3836)"

This reverts commit 81e3804.

---------

Co-authored-by: Daniel Lu <[email protected]>
  • Loading branch information
snowystinger and LFDanLu committed Aug 15, 2024
1 parent 7e10448 commit ec75091
Show file tree
Hide file tree
Showing 41 changed files with 186 additions and 105 deletions.
44 changes: 16 additions & 28 deletions packages/@react-aria/selection/src/useSelectableCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,57 +164,49 @@ export function useSelectableCollection(options: AriaSelectableCollectionOptions
switch (e.key) {
case 'ArrowDown': {
if (delegate.getKeyBelow) {
e.preventDefault();
let nextKey = manager.focusedKey != null
? delegate.getKeyBelow?.(manager.focusedKey)
? delegate.getKeyBelow(manager.focusedKey)
: delegate.getFirstKey?.();
if (nextKey == null && shouldFocusWrap) {
nextKey = delegate.getFirstKey?.(manager.focusedKey);
}
if (nextKey != null) {
e.preventDefault();
navigateToKey(nextKey);
}
navigateToKey(nextKey);
}
break;
}
case 'ArrowUp': {
if (delegate.getKeyAbove) {
e.preventDefault();
let nextKey = manager.focusedKey != null
? delegate.getKeyAbove?.(manager.focusedKey)
? delegate.getKeyAbove(manager.focusedKey)
: delegate.getLastKey?.();
if (nextKey == null && shouldFocusWrap) {
nextKey = delegate.getLastKey?.(manager.focusedKey);
}
if (nextKey != null) {
e.preventDefault();
navigateToKey(nextKey);
}
navigateToKey(nextKey);
}
break;
}
case 'ArrowLeft': {
if (delegate.getKeyLeftOf) {
let nextKey = delegate.getKeyLeftOf?.(manager.focusedKey);
e.preventDefault();
let nextKey = delegate.getKeyLeftOf(manager.focusedKey);
if (nextKey == null && shouldFocusWrap) {
nextKey = direction === 'rtl' ? delegate.getFirstKey?.(manager.focusedKey) : delegate.getLastKey?.(manager.focusedKey);
}
if (nextKey != null) {
e.preventDefault();
navigateToKey(nextKey, direction === 'rtl' ? 'first' : 'last');
}
navigateToKey(nextKey, direction === 'rtl' ? 'first' : 'last');
}
break;
}
case 'ArrowRight': {
if (delegate.getKeyRightOf) {
let nextKey = delegate.getKeyRightOf?.(manager.focusedKey);
e.preventDefault();
let nextKey = delegate.getKeyRightOf(manager.focusedKey);
if (nextKey == null && shouldFocusWrap) {
nextKey = direction === 'rtl' ? delegate.getLastKey?.(manager.focusedKey) : delegate.getFirstKey?.(manager.focusedKey);
}
if (nextKey != null) {
e.preventDefault();
navigateToKey(nextKey, direction === 'rtl' ? 'last' : 'first');
}
navigateToKey(nextKey, direction === 'rtl' ? 'last' : 'first');
}
break;
}
Expand Down Expand Up @@ -244,20 +236,16 @@ export function useSelectableCollection(options: AriaSelectableCollectionOptions
break;
case 'PageDown':
if (delegate.getKeyPageBelow) {
e.preventDefault();
let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
if (nextKey != null) {
e.preventDefault();
navigateToKey(nextKey);
}
navigateToKey(nextKey);
}
break;
case 'PageUp':
if (delegate.getKeyPageAbove) {
e.preventDefault();
let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
if (nextKey != null) {
e.preventDefault();
navigateToKey(nextKey);
}
navigateToKey(nextKey);
}
break;
case 'a':
Expand Down
23 changes: 7 additions & 16 deletions packages/@react-aria/tabs/src/TabsKeyboardDelegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ export class TabsKeyboardDelegate<T> implements KeyboardDelegate {
private collection: Collection<Node<T>>;
private flipDirection: boolean;
private disabledKeys: Set<Key>;
private tabDirection: boolean;

constructor(collection: Collection<Node<T>>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {
this.collection = collection;
this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
this.disabledKeys = disabledKeys;
this.tabDirection = orientation === 'horizontal';
}

getKeyLeftOf(key: Key) {
Expand All @@ -39,6 +37,13 @@ export class TabsKeyboardDelegate<T> implements KeyboardDelegate {
return this.getNextKey(key);
}

getKeyAbove(key: Key) {
return this.getPreviousKey(key);
}

getKeyBelow(key: Key) {
return this.getNextKey(key);
}

private isDisabled(key: Key) {
return this.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled;
Expand All @@ -59,20 +64,6 @@ export class TabsKeyboardDelegate<T> implements KeyboardDelegate {
}
return key;
}

getKeyAbove(key: Key) {
if (this.tabDirection) {
return null;
}
return this.getPreviousKey(key);
}

getKeyBelow(key: Key) {
if (this.tabDirection) {
return null;
}
return this.getNextKey(key);
}

getNextKey(key) {
do {
Expand Down
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/ar-AE.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "حدد خيارًا...",
"slider.maximum": "أقصى",
"slider.minimum": "أدنى",
"tag.noTags": "بدون"
"tag.actions": "الإجراءات",
"tag.hideButtonLabel": "إظهار أقل",
"tag.noTags": "بدون",
"tag.showAllButtonLabel": "عرض الكل ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/bg-BG.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Изберете опция",
"slider.maximum": "Максимум",
"slider.minimum": "Минимум",
"tag.noTags": "Нито един"
"tag.actions": "Действия",
"tag.hideButtonLabel": "Показване на по-малко",
"tag.noTags": "Нито един",
"tag.showAllButtonLabel": "Показване на всички ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/cs-CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Vyberte vhodnou možnost...",
"slider.maximum": "Maximum",
"slider.minimum": "Minimum",
"tag.noTags": "Žádný"
"tag.actions": "Akce",
"tag.hideButtonLabel": "Zobrazit méně",
"tag.noTags": "Žádný",
"tag.showAllButtonLabel": "Zobrazit vše ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/da-DK.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Vælg en mulighed ...",
"slider.maximum": "Maksimum",
"slider.minimum": "Minimum",
"tag.noTags": "Ingen"
"tag.actions": "Handlinger",
"tag.hideButtonLabel": "Vis mindre",
"tag.noTags": "Ingen",
"tag.showAllButtonLabel": "Vis alle ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Option auswählen...",
"slider.maximum": "Maximum",
"slider.minimum": "Minimum",
"tag.noTags": "Keine"
"tag.actions": "Aktionen",
"tag.hideButtonLabel": "Weniger zeigen",
"tag.noTags": "Keine",
"tag.showAllButtonLabel": "Alle anzeigen ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/el-GR.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Επιλέξτε…",
"slider.maximum": "Μέγιστο",
"slider.minimum": "Ελάχιστο",
"tag.noTags": "Κανένα"
"tag.actions": "Ενέργειες",
"tag.hideButtonLabel": "Εμφάνιση λιγότερων",
"tag.noTags": "Κανένα",
"tag.showAllButtonLabel": "Εμφάνιση όλων ({tagCount, number})"
}
3 changes: 3 additions & 0 deletions packages/@react-spectrum/s2/intl/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Select…",
"slider.minimum": "Minimum",
"slider.maximum": "Maximum",
"tag.showAllButtonLabel": "Show all ({tagCount, number})",
"tag.hideButtonLabel": "Show less",
"tag.actions": "Actions",
"tag.noTags": "None"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Seleccione una opción…",
"slider.maximum": "Máximo",
"slider.minimum": "Mínimo",
"tag.noTags": "Ninguno"
"tag.actions": "Acciones",
"tag.hideButtonLabel": "Mostrar menos",
"tag.noTags": "Ninguno",
"tag.showAllButtonLabel": "Mostrar todo ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/et-EE.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Valige valikuline...",
"slider.maximum": "Maksimaalne",
"slider.minimum": "Minimaalne",
"tag.noTags": "Puudub"
"tag.actions": "Toimingud",
"tag.hideButtonLabel": "Kuva vähem",
"tag.noTags": "Puudub",
"tag.showAllButtonLabel": "Kuva kõik ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/fi-FI.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Valitse vaihtoehto...",
"slider.maximum": "Maksimi",
"slider.minimum": "Minimi",
"tag.noTags": "Ei mitään"
"tag.actions": "Toiminnot",
"tag.hideButtonLabel": "Näytä vähemmän",
"tag.noTags": "Ei mitään",
"tag.showAllButtonLabel": "Näytä kaikki ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Sélectionnez une option...",
"slider.maximum": "Maximum",
"slider.minimum": "Minimum",
"tag.noTags": "Aucun"
"tag.actions": "Actions",
"tag.hideButtonLabel": "Afficher moins",
"tag.noTags": "Aucun",
"tag.showAllButtonLabel": "Tout afficher ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/he-IL.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "בחר אפשרות...",
"slider.maximum": "מקסימום",
"slider.minimum": "מינימום",
"tag.noTags": "ללא"
"tag.actions": "פעולות",
"tag.hideButtonLabel": "הצג פחות",
"tag.noTags": "ללא",
"tag.showAllButtonLabel": "הצג הכל ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/hr-HR.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Odaberite opciju",
"slider.maximum": "Najviše",
"slider.minimum": "Najmanje",
"tag.noTags": "Nema"
"tag.actions": "Radnje",
"tag.hideButtonLabel": "Prikaži manje",
"tag.noTags": "Nema",
"tag.showAllButtonLabel": "Prikaži sve ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/hu-HU.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Válasszon egy opciót…",
"slider.maximum": "Maximum",
"slider.minimum": "Minimum",
"tag.noTags": "Egyik sem"
"tag.actions": "Műveletek",
"tag.hideButtonLabel": "Mutass kevesebbet",
"tag.noTags": "Egyik sem",
"tag.showAllButtonLabel": "Az összes megjelenítése ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Seleziona un’opzione...",
"slider.maximum": "Massimo",
"slider.minimum": "Minimo",
"tag.noTags": "Nessuno"
"tag.actions": "Azioni",
"tag.hideButtonLabel": "Mostra meno",
"tag.noTags": "Nessuno",
"tag.showAllButtonLabel": "Mostra tutto ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "オプションを選択...",
"slider.maximum": "最大",
"slider.minimum": "最小",
"tag.noTags": "なし"
"tag.actions": "アクション",
"tag.hideButtonLabel": "表示を減らす",
"tag.noTags": "なし",
"tag.showAllButtonLabel": "すべての ({tagCount, number}) を表示"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "선택 사항 선택",
"slider.maximum": "최대",
"slider.minimum": "최소",
"tag.noTags": "없음"
"tag.actions": "액션",
"tag.hideButtonLabel": "간단히 표시",
"tag.noTags": "없음",
"tag.showAllButtonLabel": "모두 표시 ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/lt-LT.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Pasirinkite parinktį...",
"slider.maximum": "Daugiausia",
"slider.minimum": "Mažiausia",
"tag.noTags": "Nėra"
"tag.actions": "Veiksmai",
"tag.hideButtonLabel": "Rodyti mažiau",
"tag.noTags": "Nėra",
"tag.showAllButtonLabel": "Rodyti viską ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/lv-LV.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Atlasiet opciju...",
"slider.maximum": "Maksimālā vērtība",
"slider.minimum": "Minimālā vērtība",
"tag.noTags": "Nav"
"tag.actions": "Darbības",
"tag.hideButtonLabel": "Rādīt mazāk",
"tag.noTags": "Nav",
"tag.showAllButtonLabel": "Rādīt visu ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/nb-NO.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Velg et alternativ...",
"slider.maximum": "Maksimum",
"slider.minimum": "Minimum",
"tag.noTags": "Ingen"
"tag.actions": "Handlinger",
"tag.hideButtonLabel": "Vis mindre",
"tag.noTags": "Ingen",
"tag.showAllButtonLabel": "Vis alle ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Optie selecteren...",
"slider.maximum": "Maximum",
"slider.minimum": "Minimum",
"tag.noTags": "Geen"
"tag.actions": "Acties",
"tag.hideButtonLabel": "Minder weergeven",
"tag.noTags": "Geen",
"tag.showAllButtonLabel": "Alles tonen ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/pl-PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Wybierz opcję...",
"slider.maximum": "Maksimum",
"slider.minimum": "Minimum",
"tag.noTags": "Brak"
"tag.actions": "Działania",
"tag.hideButtonLabel": "Wyświetl mniej",
"tag.noTags": "Brak",
"tag.showAllButtonLabel": "Pokaż wszystko ({tagCount, number})"
}
5 changes: 4 additions & 1 deletion packages/@react-spectrum/s2/intl/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"picker.placeholder": "Selecione uma opção...",
"slider.maximum": "Máximo",
"slider.minimum": "Mínimo",
"tag.noTags": "Nenhum"
"tag.actions": "Ações",
"tag.hideButtonLabel": "Mostrar menos",
"tag.noTags": "Nenhum",
"tag.showAllButtonLabel": "Mostrar tudo ({tagCount, number})"
}
Loading

0 comments on commit ec75091

Please sign in to comment.