Skip to content

Commit

Permalink
refactor(translations): move new translations to a11y section
Browse files Browse the repository at this point in the history
  • Loading branch information
Catalin authored and JanPodmajersky committed Sep 3, 2024
1 parent 0c964c0 commit bed6a9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 4 additions & 5 deletions packages/emoji-mart-data/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
"search": "Search",
"search_no_results_1": "Oh no!",
"search_no_results_2": "That emoji couldn’t be found",
"emojis_found_plural": "emojis found",
"emoji_found_singular": "emoji found",
"search_input_aria_label": "Search emojis",
"available_emojis": "Available emojis",
"pick": "Pick an emoji…",
"add_custom": "Add custom emoji",
"categories": {
Expand All @@ -31,6 +27,9 @@
"6": "Dark"
},
"a11y": {
"available_emojis": "Available emojis"
"available_emojis": "Available emojis",
"emojis_found_plural": "emojis found",
"emoji_found_singular": "emoji found",
"search_input_aria_label": "Search emojis"
}
}
8 changes: 5 additions & 3 deletions packages/emoji-mart/src/components/Picker/Picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,9 @@ export default class Picker extends Component {
} else {
let count = searchResults.flat().length
let translation =
count === 1 ? I18n.emoji_found_singular : I18n.emojis_found_plural
count === 1
? I18n?.a11y?.emoji_found_singular
: I18n?.a11y?.emojis_found_plural
return [count, translation].join(' ')
}
}
Expand All @@ -889,7 +891,7 @@ export default class Picker extends Component {
onClick={this.handleSearchClick}
onInput={this.handleSearchInput}
onKeyDown={this.handleEmojisKeyDown}
aria-label={I18n.search_input_aria_label}
aria-label={I18n?.a11y?.search_input_aria_label}
autocomplete="off"
/>
<span aria-hidden="true" class="icon loupe flex">
Expand Down Expand Up @@ -974,7 +976,7 @@ export default class Picker extends Component {
}}
role="listbox"
onKeyDown={this.handleEmojisKeyDown}
aria-label={I18n.available_emojis}
aria-label={I18n?.a11y?.available_emojis}
>
{categories.map((category) => {
const { root, rows } = this.refs.categories.get(category.id)
Expand Down

0 comments on commit bed6a9a

Please sign in to comment.