Skip to content

Commit

Permalink
Add a pluralized translation string
Browse files Browse the repository at this point in the history
  • Loading branch information
pavish committed Nov 9, 2023
1 parent 7ee3b43 commit 9196dd9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
28 changes: 22 additions & 6 deletions mathesar_ui/src/components/breadcrumb/BreadcrumbSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
} from '@mathesar/component-library';
import TextInputWithPrefix from '@mathesar/component-library/text-input/TextInputWithPrefix.svelte';
import { iconExpandRight } from '@mathesar/icons';
import { labeledCount } from '@mathesar/utils/languageUtils';
import { _ } from 'svelte-i18n';
import { RichText } from '@mathesar/components/rich-text';
import BreadcrumbSelectorRow from './BreadcrumbSelectorRow.svelte';
import type { BreadcrumbSelectorData } from './breadcrumbTypes';
import { filterBreadcrumbSelectorData } from './breadcrumbUtils';
Expand Down Expand Up @@ -71,10 +72,21 @@
{#if filterString?.length === 0}
{categoryName}
{:else}
{labeledCount(entries, 'matches')}
for
<b>{filterString}</b>
{processedData.size > 1 ? `in ${categoryName}` : ''}
<RichText
text={$_('number_of_matches', {
values: {
count: entries.length,
categoryCount: processedData.size > 1 ? 1 : 0,
},
})}
let:slotName
>
{#if slotName === 'searchValue'}
<b>{filterString}</b>
{:else if slotName === 'categoryName'}
{categoryName}
{/if}
</RichText>
{/if}
</div>
<ul class="items">
Expand All @@ -92,7 +104,11 @@
{:else}
{#if filterString.length > 0}
<div class="section-name">
No matches for <b>{filterString}</b>
<RichText text={$_('no_matches')} let:slotName>
{#if slotName === 'searchValue'}
<b>{filterString}</b>
{/if}
</RichText>
</div>
{/if}
{/each}
Expand Down
2 changes: 2 additions & 0 deletions mathesar_ui/src/i18n/languages/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"many_to_one": "Many to One",
"many_to_one_link_description": "Multiple [baseTable] records can link to the same [targetTable] record.",
"no_file_uploaded": "No file uploaded",
"no_matches": "No matches for [searchValue]",
"number_of_matches": "{count, plural, one {{count} match} other {{count} matches}} for [searchValue] {categoryCount, plural, one {in [categoryName]} other{}}",
"one_to_many": "One to Many",
"one_to_many_link_desc": "One [baseTable] record can be linked from multiple [targetTable] records.",
"processing_data": "Processing Data",
Expand Down

0 comments on commit 9196dd9

Please sign in to comment.