Browse Source

feat(utils): new utilization

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

247
src/utils/locales/en.json

@ -1,189 +1,90 @@
{
"menu": {
"home": "Home",
"history": "History",
"profile": "Profile"
},
"global": {
"save" : "Save",
"delete" : "Delete",
"cancel" : "Cancel",
"signin" : "Sign In",
"logout" : "Logout",
"register" : "Register",
"start" : "Start",
"onprogress" : "On Progress",
"yes" : "Yes",
"no" : "No",
"ok" : "Ok",
"completed" : "Completed",
"canceled" : "Dibatalkan",
"notes" : "Notes",
"date" : "Dates",
"done" : "Done",
"reset" : "Reset",
"close" : "Close",
"forgotpin" : "Forgot PIN",
"send" : "Send",
"sending" : "Sending",
"errorConnectionMsg" : "Failed to connect internet",
"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"
"save": "Save",
"delete": "Delete",
"edit": "Edit",
"cancel": "Cancel",
"signin": "Sign In",
"logout": "Logout",
"yes": "Yes",
"no": "No",
"ok": "Ok",
"see": "Detail",
"completed": "Completed",
"canceled": "Dibatalkan",
"notes": "Notes",
"date": "Dates",
"done": "Done",
"reset": "Reset",
"close": "Close",
"send": "Send",
"sending": "Sending",
"errorConnectionMsg": "Failed to connect internet",
"areYouSure": "Are you sure?",
"noData": "No data found"
},
"profile": {
"profile" : "Profile",
"profilePicture" : "Profile Picture",
"changeProfile" : "Change Profile Picture",
"name" : "Name",
"changeName" : "Change Full Name",
"password" : "Password",
"changePassword" : "Change Password",
"signout" : "Sign Out",
"signoutMessage" : "Are you sure?",
"about" : "About",
"languageSetting" : "Language Setting"
"profile": "Profile",
"profilePicture": "Profile Picture",
"changeProfile": "Change Profile Picture",
"name": "Name",
"changeName": "Change Full Name",
"password": "Password",
"changePassword": "Change Password",
"signout": "Sign Out",
"signoutMessage": "Are you sure?",
"about": "About",
"languageSetting": "Language Setting"
},
"login": {
"welcomeMessage" : "Welcome back!",
"scanuserid" : "Scan User ID",
"userlogin" : "Login User",
"userregister" : "Register User",
"successRegis" : "Register Success, Please Login.",
"successResetPin" : "PIN has been reset, please contact Admin!",
"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!",
"usernamenotexist" : "Username does not exist!",
"cannotResetPin" : "Cannot reset PIN, username you entered does not match the IMEI number on your cellphone!"
"welcomeMessage": "Welcome back!",
"scanuserid": "Scan User ID",
"userlogin": "Login User",
"userregister": "Register User",
"successRegis": "Register Success, Please Login.",
"successResetPin": "PIN has been reset, please contact Admin!",
"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!",
"usernamenotexist": "Username does not exist!",
"cannotResetPin": "Cannot reset PIN, username you entered does not match the IMEI number on your cellphone!"
},
"home": {
"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"
"welcomeMessage": "Welcome"
},
"takePicture": {
"select" : "Select",
"upload" : "Upload",
"listpicture" : "List Picture",
"uploading" : "Uploading",
"selectPhoto" : "Select a photo",
"takePhoto" : "Take a photo",
"takeGallery" : "Choose from gallery",
"deletePhoto" : "Delete Photo",
"confirmDelete" : "Are you sure you want to delete this photo",
"notUpload" : "You have not uploaded any photo yet",
"uploadImage" : "Upload Image",
"cameraPermissionTitle" : "OSPOD Camera Permission",
"cameraPermissionMessage" : "OSPOD needs access to your camera, so you can take pictures.",
"cameraPermissionBtnNeutral" : "Ask Me Later",
"cameraPermissionBtnPositive" : "Cancel",
"cameraPermissionBtnNegative" : "OK",
"noImage" : "No image available",
"fakeGPSDetected" : "Fake GPS Detected",
"fakeGPSFailedMessage" : "You can't continue. Please turn off the fake gps provider.",
"successDeletePhoto" : "Successfully deleted photo.",
"failedDeletePhoto" : "Failed to delete photo."
"select": "Select",
"upload": "Upload",
"listpicture": "List Picture",
"uploading": "Uploading",
"selectPhoto": "Select a photo",
"takePhoto": "Take a photo",
"takeGallery": "Choose from gallery",
"deletePhoto": "Delete Photo",
"confirmDelete": "Are you sure you want to delete this photo",
"notUpload": "You have not uploaded any photo yet",
"uploadImage": "Upload Image",
"cameraPermissionTitle": "OSPOD Camera Permission",
"cameraPermissionMessage": "OSPOD needs access to your camera, so you can take pictures.",
"cameraPermissionBtnNeutral": "Ask Me Later",
"cameraPermissionBtnPositive": "Cancel",
"cameraPermissionBtnNegative": "OK",
"noImage": "No image available",
"fakeGPSDetected": "Fake GPS Detected",
"fakeGPSFailedMessage": "You can't continue. Please turn off the fake gps provider.",
"successDeletePhoto": "Successfully deleted photo.",
"failedDeletePhoto": "Failed to delete photo."
},
"history": {
"navbarTitle" : "Shipment History",
"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"
"navbarTitle": "Shipment Presence"
},
"shipmentDigital": {
"navbarTitle" : "Shipment Digital"
"incidentReport": {
"title": "Incident Report",
"add": "Add Incident Report",
"containedAction": "Add Contained Action"
},
"label": {
"shipmentDate" : "Shipment Date",
"shipmentNumber" : "No. Shipment",
"dropPointLocations" : "Locations"
"patrol": {
"title": "Patrol",
"add": "Add Patrol Data",
"detail": "Detail Information"
}
}

126
src/utils/locales/id.json

@ -1,21 +1,15 @@
{
"menu": {
"home": "Beranda",
"history": "Riwayat",
"profile": "Profil"
},
"global": {
"save": "Simpan",
"delete": "Hapus",
"edit": "Ubah",
"cancel": "Batal",
"signin": "Masuk",
"logout": "keluar",
"register": "Mendaftar",
"start": "Mulai",
"onprogress": "Sedang berjalan",
"yes": "Ya",
"no": "Tidak",
"ok": "Ok",
"see": "Lihat",
"completed": "Selesai",
"canceled": "Dibatalkan",
"notes": "Catatan",
@ -23,7 +17,6 @@
"done": "Selesai",
"reset": "Atur Ulang",
"close": "Tutup",
"forgotpin": "Lupa PIN",
"send": "Kirim",
"sending": "Mengirim",
"errorConnectionMsg": "Gagal menghubungkan ke internet",
@ -35,28 +28,10 @@
"loginPage": {
"headMessage": "Selamat datang!",
"signInBtn": "MASUK",
"usingQRBtn": "MASUK DENGAN QR",
"registerMessage": "Belum memiliki akun?",
"register": "Daftar",
"usernameErrorMsg": "Username harus di antara 3-30 karakter",
"passwordErrorMsg": "PIN tidak boleh kosong",
"passwordErrorMsg": "Password tidak boleh kosong",
"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": "Profil",
"profilePicture": "Foto Profil",
@ -70,63 +45,9 @@
"about": "Tentang",
"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": {
"welcomeMessage": "Selamat datang",
"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"
"home": "Beranda"
},
"takePicture": {
"select": "Pilih",
@ -152,37 +73,16 @@
"failedDeletePhoto": "Gagal menghapus foto."
},
"history": {
"navbarTitle": "Riwayat Pengiriman",
"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"
"navbarTitle": "Riwayat Kehadiran"
},
"shipmentDigital": {
"navbarTitle": "Shipment Digital"
"incidentReport": {
"title": "Laporan Kejadian",
"add": "Tambah Laporan",
"containedAction": "Tambah Rencana Pencegahan"
},
"label": {
"shipmentDate": "Waktu Pengiriman",
"shipmentNumber": "No. Pengiriman",
"dropPointLocations": "Lokasi"
"patrol": {
"title": "Patroli",
"add": "Tambah Data Patroli",
"detail": "Informasi Detail"
}
}
Loading…
Cancel
Save