Skip to content

Commit

Permalink
Merge pull request #2619 from myxmaster/language-specific-noun-casing
Browse files Browse the repository at this point in the history
add language-specific noun casing for in line usage
  • Loading branch information
kaloudis authored Dec 16, 2024
2 parents c53f3e6 + 774117e commit b82c3c9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
22 changes: 12 additions & 10 deletions components/Amount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Row } from './layout/Row';
import { Body } from './text/Body';
import LoadingIndicator from './LoadingIndicator';

import { localeString } from '../utils/LocaleUtils';
import { localeString, formatInlineNoun } from '../utils/LocaleUtils';
import { themeColor } from '../utils/ThemeUtils';
import { formatBitcoinWithSpaces } from '../utils/UnitsUtils';
import PrivacyUtils from '../utils/PrivacyUtils';
Expand Down Expand Up @@ -151,9 +151,9 @@ function AmountDisplay({
{plural ? 'sats' : 'sat'}
{fee
? ' ' +
localeString(
'views.Payment.fee'
).toLowerCase()
formatInlineNoun(
localeString('views.Payment.fee')
)
: ''}
</Body>
</View>
Expand All @@ -179,9 +179,9 @@ function AmountDisplay({
color={color}
colorOverride={colorOverride}
>
{localeString(
'views.Payment.fee'
).toLowerCase()}
{formatInlineNoun(
localeString('views.Payment.fee')
)}
</Body>
<Spacer width={2} />
</>
Expand Down Expand Up @@ -246,9 +246,11 @@ function AmountDisplay({
color={color}
colorOverride={colorOverride}
>
{localeString(
'views.Payment.fee'
).toLowerCase()}
{formatInlineNoun(
localeString(
'views.Payment.fee'
)
)}
</Body>
</View>
</>
Expand Down
13 changes: 13 additions & 0 deletions utils/LocaleUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,16 @@ export function localeString(localeString: string): any {
return English[localeString];
}
}

export const languagesWithNounCapitalization = ['de', 'pl', 'cs', 'sk'];

export const formatInlineNoun = (text: string): string => {
if (
!languagesWithNounCapitalization.includes(
stores.settingsStore?.settings?.locale || ''
)
) {
return text.toLowerCase();
}
return text;
};

0 comments on commit b82c3c9

Please sign in to comment.