Skip to content

Commit

Permalink
improve i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
CDFN committed Apr 23, 2024
1 parent 3d97b51 commit 0349f56
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const m = defineMessages({
},
loadingButtonText: {
id: 'Modal.GPSEnable.button.loading',
defaultMessage: 'Loading...',
defaultMessage: 'Loading',
},
trackingDescription: {
id: 'Modal.GPSEnable.trackingDescription',
Expand Down
17 changes: 6 additions & 11 deletions src/frontend/screens/MapScreen/track/SaveTrackScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,18 @@ import {TrackDescriptionField} from './saveTrack/TrackDescriptionField';
import {NavigationProp} from '@react-navigation/native';

const m = defineMessages({
editTitle: {
id: 'screens.ObservationEdit.editTitle',
defaultMessage: 'Edit Observation',
description: 'screen title for edit observation screen',
},
newTitle: {
id: 'screens.ObservationEdit.newTitle',
defaultMessage: 'New Observation',
description: 'screen title for new observation screen',
id: 'screens.SaveTrack.track',
defaultMessage: 'Track',
description: 'Category title for new track screen',
},
detailsButton: {
id: 'screens.ObservationEdit.ObservationEditView.saveTrackDetails',
id: 'screens.SaveTrack.TrackEditView.saveTrackDetails',
defaultMessage: 'Details',
description: 'Button label for check details',
},
photoButton: {
id: 'screens.ObservationEdit.ObservationEditView.saveTrackCamera',
id: 'screens.SaveTrack.TrackEditView.saveTrackCamera',
defaultMessage: 'Camera',
description: 'Button label for adding photo',
},
Expand Down Expand Up @@ -66,7 +61,7 @@ export const SaveTrackScreen: React.FC<{navigation: NavigationProp<any>}> = ({
contentContainerStyle={styles.scrollViewContent}>
<View style={styles.titleWrapper}>
<TrackIcon style={styles.icon} />
<Text style={styles.titleText}>Track</Text>
<Text style={styles.titleText}>{t(m.newTitle)}</Text>
</View>
<TrackDescriptionField
description={description}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,27 @@ import {useCurrentTrackStore} from '../../../../hooks/tracks/useCurrentTrackStor
import {DateTime} from 'luxon';
import {TabName} from '../../../../Navigation/types';
import {useNavigationFromHomeTabs} from '../../../../hooks/useNavigationWithTypes';
import {defineMessages, useIntl} from 'react-intl';

const m = defineMessages({
trackEditScreenTitle: {
id: 'screens.SaveTrack.TrackEditView.title',
defaultMessage: 'New Track',
description: 'Title for new track screen',
},
});

export interface SaveTrackHeader {
bottomSheetRef: React.RefObject<BottomSheetModalMethods>;
}

export const SaveTrackHeader: FC<SaveTrackHeader> = ({bottomSheetRef}) => {
const saveTrack = useCreateTrack();
const currentTrack = useCurrentTrackStore();
const navigation = useNavigationFromHomeTabs();

const {formatMessage: t} = useIntl();

const handleSaveClick = () => {
saveTrack.mutate(
{
Expand Down Expand Up @@ -52,7 +66,7 @@ export const SaveTrackHeader: FC<SaveTrackHeader> = ({bottomSheetRef}) => {
onPress={() => bottomSheetRef.current?.present()}>
<Close style={styles.closeIcon} />
</Pressable>
<Text style={styles.text}>New Observation</Text>
<Text style={styles.text}>{t(m.trackEditScreenTitle)}</Text>
</View>
<Pressable disabled={saveTrack.isPending} onPress={handleSaveClick}>
<Image
Expand All @@ -63,6 +77,7 @@ export const SaveTrackHeader: FC<SaveTrackHeader> = ({bottomSheetRef}) => {
</View>
);
};

const styles = StyleSheet.create({
container: {
borderBottomWidth: 1,
Expand Down

0 comments on commit 0349f56

Please sign in to comment.