Browse Source

feat(utils): new utilization

master
farhantock 6 months ago
parent
commit
5cbbbfbef7
  1. 15
      src/utils/color.js
  2. 10
      src/utils/i18n.js
  3. 247
      src/utils/locales/en.json
  4. 126
      src/utils/locales/id.json

15
src/utils/color.js

@ -0,0 +1,15 @@
export const colors = {
blue: '#3876BF',
semiBlue: '#DCECFF',
beanRed: '#EF6262',
semiRed: '#FFC5C3',
green: '#17C13E',
semigreen: '#E3F8E8',
black: '#333333',
mistBlue: '#667085',
amethystSmoke: '#9A99AB',
mercury: '#E4E4E7',
catskillWhite: '#F2F4F6',
white: '#F9F9F9',
pureWhite: '#fFFFFF',
};

10
src/utils/i18n.js

@ -1,4 +1,4 @@
import {I18n} from "i18n-js"; import { I18n } from "i18n-js";
import * as RNLocalize from "react-native-localize"; import * as RNLocalize from "react-native-localize";
import en from "./locales/en"; import en from "./locales/en";
@ -7,17 +7,16 @@ import LocalizedStrings from "react-native-localization";
const locales = RNLocalize.getLocales(); const locales = RNLocalize.getLocales();
const i18n = new I18n({en, id}); const i18n = new I18n({ en, id });
if (Array.isArray(locales)) { if (Array.isArray(locales)) {
i18n.locale = locales[0].languageCode; i18n.locale = locales[0].languageCode;
} }
i18n.fallbacks = true; i18n.fallbacks = true;
// The method we'll use instead of a regular string
export const strings = (name, params = {}) => { export const strings = (name, params = {}) => {
return i18n.t(name, params); return i18n.t(name, params);
} }
const localStr = new LocalizedStrings({ const localStr = new LocalizedStrings({
@ -26,6 +25,5 @@ const localStr = new LocalizedStrings({
}); });
export const changeLanguage = (languageKey) => { export const changeLanguage = (languageKey) => {
console.log('changeLanguage', languageKey)
localStr.setLanguage(languageKey) localStr.setLanguage(languageKey)
} }

247
src/utils/locales/en.json

@ -1,189 +1,90 @@
{ {
"menu": {
"home": "Home",
"history": "History",
"profile": "Profile"
},
"global": { "global": {
"save" : "Save", "save": "Save",
"delete" : "Delete", "delete": "Delete",
"cancel" : "Cancel", "edit": "Edit",
"signin" : "Sign In", "cancel": "Cancel",
"logout" : "Logout", "signin": "Sign In",
"register" : "Register", "logout": "Logout",
"start" : "Start", "yes": "Yes",
"onprogress" : "On Progress", "no": "No",
"yes" : "Yes", "ok": "Ok",
"no" : "No", "see": "Detail",
"ok" : "Ok", "completed": "Completed",
"completed" : "Completed", "canceled": "Dibatalkan",
"canceled" : "Dibatalkan", "notes": "Notes",
"notes" : "Notes", "date": "Dates",
"date" : "Dates", "done": "Done",
"done" : "Done", "reset": "Reset",
"reset" : "Reset", "close": "Close",
"close" : "Close", "send": "Send",
"forgotpin" : "Forgot PIN", "sending": "Sending",
"send" : "Send", "errorConnectionMsg": "Failed to connect internet",
"sending" : "Sending", "areYouSure": "Are you sure?",
"errorConnectionMsg" : "Failed to connect internet", "noData": "No data found"
"scan" : "Scan",
"reject" : "Reject",
"areYouSure" : "Are you sure?",
"noData" : "No data found"
},
"loginPage": {
"headMessage" : "Welcome back!",
"signInBtn" : "SIGN IN",
"usingQRBtn" : "USING QR INSTEAD",
"registerMessage" : "Don't have an account?",
"register" : "Register",
"usernameErrorMsg" : "Username field must be between 3-30 character",
"passwordErrorMsg" : "PIN is required",
"successLogin" : "You are successfully logged in"
},
"loginQRPage": {
"navbarTitle" : "Driver Login",
"caption" : "Scan QR Code"
},
"shipmentQRPage": {
"navbarTitle" : "Scan Order",
"caption" : "Scan QR Code"
},
"registerPage": {
"navbarTitle" : "Driver Register",
"headMessage" : "Create an account",
"registerBtn" : "REGISTER",
"usernameErrorMsg" : "Username is required",
"passwordErrorMsg" : "PIN is required"
}, },
"profile": { "profile": {
"profile" : "Profile", "profile": "Profile",
"profilePicture" : "Profile Picture", "profilePicture": "Profile Picture",
"changeProfile" : "Change Profile Picture", "changeProfile": "Change Profile Picture",
"name" : "Name", "name": "Name",
"changeName" : "Change Full Name", "changeName": "Change Full Name",
"password" : "Password", "password": "Password",
"changePassword" : "Change Password", "changePassword": "Change Password",
"signout" : "Sign Out", "signout": "Sign Out",
"signoutMessage" : "Are you sure?", "signoutMessage": "Are you sure?",
"about" : "About", "about": "About",
"languageSetting" : "Language Setting" "languageSetting": "Language Setting"
}, },
"login": { "login": {
"welcomeMessage" : "Welcome back!", "welcomeMessage": "Welcome back!",
"scanuserid" : "Scan User ID", "scanuserid": "Scan User ID",
"userlogin" : "Login User", "userlogin": "Login User",
"userregister" : "Register User", "userregister": "Register User",
"successRegis" : "Register Success, Please Login.", "successRegis": "Register Success, Please Login.",
"successResetPin" : "PIN has been reset, please contact Admin!", "successResetPin": "PIN has been reset, please contact Admin!",
"successResetPin2" : "Please check your email or contact your Admin for confirm!", "successResetPin2": "Please check your email or contact your Admin for confirm!",
"successResetPin3" : "Your account has been reset and confirmed by the admin, please re-register!", "successResetPin3": "Your account has been reset and confirmed by the admin, please re-register!",
"usernamenotexist" : "Username does not exist!", "usernamenotexist": "Username does not exist!",
"cannotResetPin" : "Cannot reset PIN, username you entered does not match the IMEI number on your cellphone!" "cannotResetPin": "Cannot reset PIN, username you entered does not match the IMEI number on your cellphone!"
}, },
"home": { "home": {
"welcomeMessage" : "Welcome", "welcomeMessage": "Welcome"
"home" : "Home",
"noOrder" : "You don't have a new order",
"getNewOrder" : "You have a new order!",
"scanOrder" : "Scan Order",
"delivorder" : "Delivery Order",
"loadlocation" : "Loading Location",
"cancelShipment" : "Why do you want to cancel this shipment?",
"rejectShipment" : "Why do you want to reject this shipment?",
"startDeliv" : "Start Delivery",
"cancelDeliv" : "Cancel Delivery",
"rejectDeliv" : "Reject Delivery",
"confirm" : "Are you sure?",
"confirmStartDeliv" : "Are you sure want to start this delivery?",
"writeReasonError" : "Note cannot be empty",
"writeReasonPlaceholder": "Write your reason here",
"continueDelivery" : "Continue Delivery",
"continueDeliveryMsg" : "You have an unfinish order, continue to complete it!",
"successStart" : "Successfully start shipment.",
"failedStart" : "Failed to start shipment. Check your internet connectivity and try again later.",
"successCancel" : "Successfully reject shipment.",
"failedCancel" : "Failed to reject shipment. Check your internet connectivity and try again later."
},
"startDeliv": {
"ongoingorder" : "Ongoing Order",
"deliveryorder" : "Delivery Order",
"origin" : "Loading Location",
"destination" : "Destination",
"arrived" : "Arrived",
"shipNumber" : "Shipment Number",
"licensePlate" : "License Plate",
"shipStart" : "Shipment Start",
"shipEnd" : "Shipment End",
"deliveryPictures" : "Delivery Pictures",
"deliveringOrder" : "Delivering Order",
"successArrived" : "Arrived successfully. Please take a proof delivery picture to continue.",
"failedArrived" : "Gagal sampai tujuan. Periksa koneksi internet anda dan ulangi kembali.",
"finishTask" : "Finish Task",
"successContinue" : "Task finished successfully. Continue to next location.",
"successComplete" : "Shipment completed.",
"errorEmptyPhoto" : "Take a proof delivery picture to continue"
},
"photoPreview": {
"navbarTitle" : "Delivery Picture"
}, },
"takePicture": { "takePicture": {
"select" : "Select", "select": "Select",
"upload" : "Upload", "upload": "Upload",
"listpicture" : "List Picture", "listpicture": "List Picture",
"uploading" : "Uploading", "uploading": "Uploading",
"selectPhoto" : "Select a photo", "selectPhoto": "Select a photo",
"takePhoto" : "Take a photo", "takePhoto": "Take a photo",
"takeGallery" : "Choose from gallery", "takeGallery": "Choose from gallery",
"deletePhoto" : "Delete Photo", "deletePhoto": "Delete Photo",
"confirmDelete" : "Are you sure you want to delete this photo", "confirmDelete": "Are you sure you want to delete this photo",
"notUpload" : "You have not uploaded any photo yet", "notUpload": "You have not uploaded any photo yet",
"uploadImage" : "Upload Image", "uploadImage": "Upload Image",
"cameraPermissionTitle" : "OSPOD Camera Permission", "cameraPermissionTitle": "OSPOD Camera Permission",
"cameraPermissionMessage" : "OSPOD needs access to your camera, so you can take pictures.", "cameraPermissionMessage": "OSPOD needs access to your camera, so you can take pictures.",
"cameraPermissionBtnNeutral" : "Ask Me Later", "cameraPermissionBtnNeutral": "Ask Me Later",
"cameraPermissionBtnPositive" : "Cancel", "cameraPermissionBtnPositive": "Cancel",
"cameraPermissionBtnNegative" : "OK", "cameraPermissionBtnNegative": "OK",
"noImage" : "No image available", "noImage": "No image available",
"fakeGPSDetected" : "Fake GPS Detected", "fakeGPSDetected": "Fake GPS Detected",
"fakeGPSFailedMessage" : "You can't continue. Please turn off the fake gps provider.", "fakeGPSFailedMessage": "You can't continue. Please turn off the fake gps provider.",
"successDeletePhoto" : "Successfully deleted photo.", "successDeletePhoto": "Successfully deleted photo.",
"failedDeletePhoto" : "Failed to delete photo." "failedDeletePhoto": "Failed to delete photo."
}, },
"history": { "history": {
"navbarTitle" : "Shipment History", "navbarTitle": "Shipment Presence"
"noTask" : "You haven't completed any task",
"dropPointPictures" : "Drop Point Pictures",
"signaturePicture" : "Signature"
},
"dropPoint": {
"cancelDrop" : "Why do you want to cancel this Drop Point",
"arrivedTime" : "Arrived Time",
"startTime" : "Start Time",
"finishedTime" : "Finished Time",
"exitTime" : "Exit Time",
"reason" : "Reason",
"noDetail" : "No Detail"
},
"signature": {
"navbarTitle" : "Signature",
"newSignature" : "Take a new signature",
"newSignatureAlertMessage": "You will replace this current signature",
"remark" : "Set Remark",
"remarkInstruction" : "Send a feedback about shipment at this location",
"remarkPlaceholder" : "Write your note here",
"noData" : "No signature found",
"uploadSuccess" : "Successfully uploaded signature",
"successSendRemark" : "Successfully send remark"
}, },
"shipmentDigital": { "incidentReport": {
"navbarTitle" : "Shipment Digital" "title": "Incident Report",
"add": "Add Incident Report",
"containedAction": "Add Contained Action"
}, },
"label": { "patrol": {
"shipmentDate" : "Shipment Date", "title": "Patrol",
"shipmentNumber" : "No. Shipment", "add": "Add Patrol Data",
"dropPointLocations" : "Locations" "detail": "Detail Information"
} }
} }

126
src/utils/locales/id.json

@ -1,21 +1,15 @@
{ {
"menu": {
"home": "Beranda",
"history": "Riwayat",
"profile": "Profil"
},
"global": { "global": {
"save": "Simpan", "save": "Simpan",
"delete": "Hapus", "delete": "Hapus",
"edit": "Ubah",
"cancel": "Batal", "cancel": "Batal",
"signin": "Masuk", "signin": "Masuk",
"logout": "keluar", "logout": "keluar",
"register": "Mendaftar",
"start": "Mulai",
"onprogress": "Sedang berjalan",
"yes": "Ya", "yes": "Ya",
"no": "Tidak", "no": "Tidak",
"ok": "Ok", "ok": "Ok",
"see": "Lihat",
"completed": "Selesai", "completed": "Selesai",
"canceled": "Dibatalkan", "canceled": "Dibatalkan",
"notes": "Catatan", "notes": "Catatan",
@ -23,7 +17,6 @@
"done": "Selesai", "done": "Selesai",
"reset": "Atur Ulang", "reset": "Atur Ulang",
"close": "Tutup", "close": "Tutup",
"forgotpin": "Lupa PIN",
"send": "Kirim", "send": "Kirim",
"sending": "Mengirim", "sending": "Mengirim",
"errorConnectionMsg": "Gagal menghubungkan ke internet", "errorConnectionMsg": "Gagal menghubungkan ke internet",
@ -35,28 +28,10 @@
"loginPage": { "loginPage": {
"headMessage": "Selamat datang!", "headMessage": "Selamat datang!",
"signInBtn": "MASUK", "signInBtn": "MASUK",
"usingQRBtn": "MASUK DENGAN QR",
"registerMessage": "Belum memiliki akun?",
"register": "Daftar",
"usernameErrorMsg": "Username harus di antara 3-30 karakter", "usernameErrorMsg": "Username harus di antara 3-30 karakter",
"passwordErrorMsg": "PIN tidak boleh kosong", "passwordErrorMsg": "Password tidak boleh kosong",
"successLogin": "Berhasil login aplikasi" "successLogin": "Berhasil login aplikasi"
}, },
"loginQRPage": {
"navbarTitle": "Masuk Aplikasi",
"caption": "Pindai Kode QR"
},
"shipmentQRPage": {
"navbarTitle": "Memindai Pesanan",
"caption": "Pindai Kode QR"
},
"registerPage": {
"navbarTitle": "Daftar Pengemudi",
"headMessage": "Daftar akun",
"registerBtn": "DAFTAR",
"usernameErrorMsg": "Username tidak boleh kosong",
"passwordErrorMsg": "PIN tidak boleh kosong"
},
"profile": { "profile": {
"profile": "Profil", "profile": "Profil",
"profilePicture": "Foto Profil", "profilePicture": "Foto Profil",
@ -70,63 +45,9 @@
"about": "Tentang", "about": "Tentang",
"languageSetting": "Pengaturan Bahasa" "languageSetting": "Pengaturan Bahasa"
}, },
"login": {
"welcomeMessage": "Selamat datang!",
"scanuserid": "Pindai ID Pengguna",
"userlogin": "Masuk Pengguna",
"userregister": "Daftar Pengguna",
"successRegis": "Berhasil mendaftar, Silahkan masuk.",
"successResetPin": "PIN berhasil di reset, harap cek email atau hubungi Admin Anda!",
"successResetPin2": "Harap cek email Anda atau hubungi Admin Anda untuk konfirmasi!",
"successResetPin3": "Akun Anda berhasil di reset dan di konfirmasi oleh Admin, silakan mendaftar ulang!",
"usernamenotexist": "Username tidak di temukan!",
"cannotResetPin": "Gagal reset PIN, username yang Anda masukkan tidak sama dengan nomor IMEI di HP Anda!"
},
"home": { "home": {
"welcomeMessage": "Selamat datang", "welcomeMessage": "Selamat datang",
"home": "Beranda", "home": "Beranda"
"noOrder": "Anda tidak memiliki pesanan baru",
"getNewOrder": "Anda memiliki pesanan baru!",
"scanOrder": "Pindai Pesanan",
"delivorder": "Mengantar Barang",
"loadlocation": "Lokasi Muat",
"cancelShipment": "Kenapa anda ingin membatalkan pengirimaan ini?",
"rejectShipment": "Kenapa anda ingin menolak pengirimaan ini?",
"startDeliv": "Mulai Pengiriman",
"cancelDeliv": "Batal Pengiriman",
"rejectDeliv": "Tolak Pengiriman",
"confirm": "Apakah anda yakin?",
"confirmStartDeliv": "Apakah anda yakin ingin memulai pengiriman?",
"writeReasonError": "Catatan tidak boleh kosong",
"writeReasonPlaceholder": "Tuliskan alasan anda di sini",
"continueDelivery": "Lanjutkan pengiriman",
"continueDeliveryMsg": "Anda memiliki pesanan yang harus diselesaikan",
"successStart": "Berhasil memulai perjalanan.",
"failedStart": "Gagal memulai perjalanan. Periksa koneksi internet anda dan ulangi kembali.",
"successCancel": "Berhasil menolak pengiriman.",
"failedCancel": "Gagal menolak pengiriman. Periksa koneksi internet anda dan ulangi kembali."
},
"startDeliv": {
"ongoingorder": "Pesanan",
"deliveryorder": "Pesan Antar Barang",
"origin": "Lokasi Muat",
"destination": "Lokasi Bongkar",
"arrived": "Sampai Tujuan",
"shipNumber": "Nomor Pengiriman",
"licensePlate": "Nomor Polisi",
"shipStart": "Mulai Pengiriman",
"shipEnd": "Akhir Pengiriman",
"deliveryPictures": "Bukti Pengiriman",
"deliveringOrder": "Mengantar Pesanan",
"successArrived": "Berhasil sampai tujuan. Ambil foto bukti pengiriman untuk dapat melanjutkan.",
"failedArrived": "Gagal sampai tujuan. Periksa koneksi internet anda dan ulangi kembali.",
"finishTask": "Selesai",
"successContinue": "Berhasil menyelesaikan tugas. Melanjutkan ke lokasi berikutnya.",
"successComplete": "Pengiriman selesai.",
"errorEmptyPhoto": "Ambil foto bukti pengiriman untuk dapat melanjutkan"
},
"photoPreview": {
"navbarTitle": "Foto Bukti Pengiriman"
}, },
"takePicture": { "takePicture": {
"select": "Pilih", "select": "Pilih",
@ -152,37 +73,16 @@
"failedDeletePhoto": "Gagal menghapus foto." "failedDeletePhoto": "Gagal menghapus foto."
}, },
"history": { "history": {
"navbarTitle": "Riwayat Pengiriman", "navbarTitle": "Riwayat Kehadiran"
"noTask": "Anda Belum menyelesaikan task",
"dropPointPictures": "Foto Bukti Pengiriman",
"signaturePicture": "Tanda Tangan"
},
"dropPoint": {
"cancelDrop": "Kenapa anda ingin membatalkan titik bongkar ini",
"arrivedTime": "Waktu Kedatangan",
"startTime": "Waktu Mulai",
"finishedTime": "Waktu Selesai",
"exitTime": "Waktu Keluar",
"reason": "Alasan",
"noDetail": "No Detail"
},
"signature": {
"navbarTitle": "Tanda Tangan",
"newSignature": "Ambil tanda Tangan baru",
"newSignatureAlertMessage": "Anda akan mengubah tanda tangan ini",
"remark": "Beri Catatan",
"remarkInstruction": "Berikan catatan mengenai pengiriman pada lokasi ini",
"remarkPlaceholder": "Tuliskan catatan anda di sini",
"noData": "Tidak ada tanda tangan ditemukan",
"uploadSuccess": "Berhasil mengirim tanda tangan",
"successSendRemark": "Berhasil mengirim catatan"
}, },
"shipmentDigital": { "incidentReport": {
"navbarTitle": "Shipment Digital" "title": "Laporan Kejadian",
"add": "Tambah Laporan",
"containedAction": "Tambah Rencana Pencegahan"
}, },
"label": { "patrol": {
"shipmentDate": "Waktu Pengiriman", "title": "Patroli",
"shipmentNumber": "No. Pengiriman", "add": "Tambah Data Patroli",
"dropPointLocations": "Lokasi" "detail": "Informasi Detail"
} }
} }
Loading…
Cancel
Save