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 0cf1cb9
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 24 deletions.
30 changes: 21 additions & 9 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"message": "Start Tracks"
},
"Modal.GPSEnable.button.loading": {
"message": "Loading..."
"message": "Loading"
},
"Modal.GPSEnable.button.stop": {
"message": "Stop Tracks"
Expand Down Expand Up @@ -374,14 +374,6 @@
"description": "Button label for adding photo",
"message": "Add Photo"
},
"screens.ObservationEdit.ObservationEditView.saveTrackCamera": {
"description": "Button label for adding photo",
"message": "Camera"
},
"screens.ObservationEdit.ObservationEditView.saveTrackDetails": {
"description": "Button label for check details",
"message": "Details"
},
"screens.ObservationEdit.ObservationEditView.searching": {
"description": "Shown in new observation screen whilst looking for GPS",
"message": "Searching…"
Expand Down Expand Up @@ -446,6 +438,26 @@
"description": "message shown whilst observations are loading",
"message": "Loading… this can take a while after synchronizing with a new device"
},
"screens.SaveTrack.TrackEditView.descriptionPlaceholder": {
"description": "Placeholder for description/notes field",
"message": "What is happening here?"
},
"screens.SaveTrack.TrackEditView.saveTrackCamera": {
"description": "Button label for adding photo",
"message": "Camera"
},
"screens.SaveTrack.TrackEditView.saveTrackDetails": {
"description": "Button label for check details",
"message": "Details"
},
"screens.SaveTrack.TrackEditView.title": {
"description": "Title for new track screen",
"message": "New Track"
},
"screens.SaveTrack.track": {
"description": "Category title for new track screen",
"message": "Track"
},
"screens.Security.obscurePassDescriptonPassNotSet": {
"message": "To use, enable App Passcode"
},
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {StyleSheet, TextInput} from 'react-native';

const m = defineMessages({
descriptionPlaceholder: {
id: 'screens.ObservationEdit.ObservationEditView.descriptionPlaceholder',
id: 'screens.SaveTrack.TrackEditView.descriptionPlaceholder',
defaultMessage: 'What is happening here?',
description: 'Placeholder for description/notes field',
},
Expand All @@ -31,7 +31,7 @@ export const TrackDescriptionField: React.FC<DescriptionField> = ({
value={description}
scrollEnabled={false}
textContentType="none"
testID="observationDescriptionField"
testID="trackDescriptionField"
/>
);
};
Expand Down

0 comments on commit 0cf1cb9

Please sign in to comment.