From 4fe9049c1eb0c13d86997798f03ce8d01f7c2eda Mon Sep 17 00:00:00 2001 From: Kashif Shehzad Baloch Date: Tue, 9 Jan 2024 12:18:43 +0500 Subject: [PATCH] remaining headers added with localisation --- RiderApp/.gitignore | 3 ++- RiderApp/languages/de.js | 6 +++++- RiderApp/languages/en.js | 6 +++++- RiderApp/languages/fr.js | 6 +++++- RiderApp/languages/km.js | 5 ++++- RiderApp/languages/zh.js | 4 ++++ RiderApp/src/screens/Chat/Chat.js | 5 +++-- RiderApp/src/screens/Login/Login.js | 10 ++++++---- RiderApp/src/screens/OrderDetail/OrderDetail.js | 4 ++-- RiderApp/src/screens/Orders/Orders.js | 11 ++++++++++- 10 files changed, 46 insertions(+), 14 deletions(-) diff --git a/RiderApp/.gitignore b/RiderApp/.gitignore index 30bc162..b2d59d1 100644 --- a/RiderApp/.gitignore +++ b/RiderApp/.gitignore @@ -1 +1,2 @@ -/node_modules \ No newline at end of file +/node_modules +/dist \ No newline at end of file diff --git a/RiderApp/languages/de.js b/RiderApp/languages/de.js index 868eb52..563c1df 100644 --- a/RiderApp/languages/de.js +++ b/RiderApp/languages/de.js @@ -147,5 +147,9 @@ export const de = { Subtotal: 'Subtotaal', Assigntome: 'Toewijzen aan mij', 'About Us': 'Over Ons', -'Product Page': 'Product Pagina', + 'Product Page': 'Product Pagina', + Order: 'Bestelling', + OrderMarkedAs: 'Bestelling gemarkeerd als', + titleLogin: 'Inloggen', + Picked: 'Gekozen', } diff --git a/RiderApp/languages/en.js b/RiderApp/languages/en.js index 73cead9..d6af8f6 100644 --- a/RiderApp/languages/en.js +++ b/RiderApp/languages/en.js @@ -146,5 +146,9 @@ export const en = { Subtotal: 'Subtotal', Assigntome: 'Assign to me', 'About Us': 'About Us', - 'Product Page': 'Product Page' + 'Product Page': 'Product Page', + Order: 'Order', + OrderMarkedAs: 'Order marked as', + titleLogin: 'Login', + Picked: 'Picked' } diff --git a/RiderApp/languages/fr.js b/RiderApp/languages/fr.js index 4c7852b..405329d 100644 --- a/RiderApp/languages/fr.js +++ b/RiderApp/languages/fr.js @@ -147,5 +147,9 @@ export const fr = { Subtotal: 'Sous-total', Assigntome: 'Attribuer à moi', 'About Us': 'À Propos de Nous', -'Product Page': 'Page Produit', + 'Product Page': 'Page Produit', + Order: 'Commande', + OrderMarkedAs: 'Commande marquée comme', + titleLogin: 'Connexion', + Picked: 'Choisi', } diff --git a/RiderApp/languages/km.js b/RiderApp/languages/km.js index bbd8099..1ac2339 100644 --- a/RiderApp/languages/km.js +++ b/RiderApp/languages/km.js @@ -144,5 +144,8 @@ export const km = { Subtotal: 'សរុបរង', Assigntome: 'ផ្ដល់ទៅខ្លួនឯង', 'About Us': 'អំពីយើង', -'Product Page': 'ទំព័រផលិតផល', + 'Product Page': 'ទំព័រផលិតផល', + Order: 'បញ្ជាទិញ', + OrderMarkedAs: 'បញ្ជាតម្រៀបជានៅជិត', + Picked: 'បានជ្រើសរើស', } diff --git a/RiderApp/languages/zh.js b/RiderApp/languages/zh.js index bc664ef..3f755cb 100644 --- a/RiderApp/languages/zh.js +++ b/RiderApp/languages/zh.js @@ -141,4 +141,8 @@ export const zh = { Assigntome: '分配给我', 'About Us': '关于我们', 'Product Page': '产品页面', +Order: '订单', +OrderMarkedAs: '标记为订单', +titleLogin: '登录', +Picked: '已选取', } diff --git a/RiderApp/src/screens/Chat/Chat.js b/RiderApp/src/screens/Chat/Chat.js index c65b690..b4e0192 100644 --- a/RiderApp/src/screens/Chat/Chat.js +++ b/RiderApp/src/screens/Chat/Chat.js @@ -1,6 +1,6 @@ import { Feather, FontAwesome } from '@expo/vector-icons' import { useNavigation } from '@react-navigation/native' -import React, { useCallback, useEffect, useState } from 'react' +import React, { useCallback, useEffect, useState, useLayoutEffect } from 'react' import { Keyboard, View } from 'react-native' import { Bubble, @@ -13,6 +13,7 @@ import { alignment } from '../../utilities/alignment' import colors from '../../utilities/colors' import { scale } from '../../utilities/scaling' import useStyle from './styles' +import i18n from '../../../i18n' const UserInfo = { _id: 1, @@ -42,7 +43,7 @@ function Chat() { useEffect(() => { navigation.setOptions({ - title: 'Chat' + headerTitle: i18n.t('titleChat') }) setMessages([ { diff --git a/RiderApp/src/screens/Login/Login.js b/RiderApp/src/screens/Login/Login.js index f981619..c37874b 100644 --- a/RiderApp/src/screens/Login/Login.js +++ b/RiderApp/src/screens/Login/Login.js @@ -4,7 +4,7 @@ import { useNavigation } from '@react-navigation/native' import Constants from 'expo-constants' import * as Notifications from 'expo-notifications' import gql from 'graphql-tag' -import React, { useContext, useEffect, useState } from 'react' +import React, { useContext, useEffect, useState,useLayoutEffect } from 'react' import { KeyboardAvoidingView, Platform, @@ -38,11 +38,13 @@ export default function Login() { const { setTokenAsync } = useContext(AuthContext) - useEffect(() => { + + useLayoutEffect(() => { navigation.setOptions({ - headerLeft: null + headerRight: null, + headerTitle: i18n.t('titleHelp') }) - }, []) + }, [navigation]) const [mutate, { loading }] = useMutation(RIDER_LOGIN, { onCompleted, diff --git a/RiderApp/src/screens/OrderDetail/OrderDetail.js b/RiderApp/src/screens/OrderDetail/OrderDetail.js index bdb64b4..aa23d07 100644 --- a/RiderApp/src/screens/OrderDetail/OrderDetail.js +++ b/RiderApp/src/screens/OrderDetail/OrderDetail.js @@ -71,13 +71,13 @@ function OrderDetail() { useLayoutEffect(() => { if (!selectedOrder) return; navigation.setOptions({ - title: `Order ${selectedOrder.order_id}`, + title: `${i18n.t('Order')} ${selectedOrder.order_id}`, }); }, [selectedOrder]); async function onCompleted({ updateOrderStatusRider, assignOrder }) { if (updateOrderStatusRider) { FlashMessage({ - message: `Order marked as ${updateOrderStatusRider.order_status}`, + message: `${i18n.t('OrderMarkedAs')} ${updateOrderStatusRider.order_status}`, }); if (updateOrderStatusRider.order_status === "DELIVERED") { navigation.goBack(); diff --git a/RiderApp/src/screens/Orders/Orders.js b/RiderApp/src/screens/Orders/Orders.js index c879e05..442b058 100644 --- a/RiderApp/src/screens/Orders/Orders.js +++ b/RiderApp/src/screens/Orders/Orders.js @@ -1,4 +1,5 @@ -import React, { useEffect, useState } from 'react' +import React, { useEffect, useState, useLayoutEffect } from 'react' +import { useNavigation } from '@react-navigation/native' import { ImageBackground, StatusBar, @@ -15,11 +16,19 @@ const BACKGROUND_IMAGE = require('../../../assets/images/ui/BG.png') export default function Orders() { const styles = useStyle() const [isNewOrderSelected, setIsNewOrderSelected] = useState(false) + const navigation = useNavigation() useEffect(() => { StatusBar.setBarStyle('light-content') }, [isNewOrderSelected]) + useLayoutEffect(() => { + navigation.setOptions({ + headerRight: null, + headerTitle: i18n.t('Orders') + }) + }, [navigation]) + return (