Skip to content

Commit

Permalink
Feature/gh 3736 (SAP#3748)
Browse files Browse the repository at this point in the history
* feature/SAPGH-3736: add script for localization process
  • Loading branch information
WeizhengSap authored Jul 29, 2019
1 parent 8668bcb commit f17883e
Show file tree
Hide file tree
Showing 16 changed files with 676 additions and 0 deletions.
Empty file added lang/properties/dummy.txt
Empty file.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"generate:changelog": "ts-node ./scripts/changelog.ts",
"generate:docs": "npx compodoc -p tsconfig.compodoc.json && ./scripts/zip-docs.sh",
"generate:translations": "ts-node ./scripts/generate-translations",
"generate:localization:properties": "ts-node ./scripts/generate-properties",
"generate:localization:jsons": "ts-node ./scripts/generate-jsons && prettier './projects/assets/src/translations/**/*.ts' --write",
"lint": "ng lint",
"i18n-lint": "i18n-lint -t \"{{,}}\" projects/storefrontlib/src/**/*.html",
"mockserver": "cd ./projects/backend/mockgenerator && npm run start",
Expand Down
2 changes: 2 additions & 0 deletions projects/assets/src/translations/translations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { en } from './en/index';
import { zh } from './zh/index';

interface TranslationResources {
[lang: string]: {
Expand All @@ -10,4 +11,5 @@ interface TranslationResources {

export const translations: TranslationResources = {
en,
zh,
};
56 changes: 56 additions & 0 deletions projects/assets/src/translations/zh/address.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
export const address = {
addressForm: {
title: 'Title',
firstName: {
label: 'First name',
placeholder: 'First Name',
},
lastName: {
label: 'Last name',
placeholder: 'Last Name',
},
address1: 'Address 1',
address2: 'Address 2 (optional)',
country: 'Country',
city: {
label: 'City',
placeholder: 'City',
},
state: 'State',
zipCode: {
label: 'Zip code',
placeholder: 'Postal Code/Zip',
},
phoneNumber: {
label: 'Phone number (optional)',
placeholder: '(555) 555 - 0123',
},
saveAsDefault: 'Save as default',
chooseAddress: 'Choose address',
streetAddress: 'Street Address',
aptSuite: 'Apt, Suite',
selectOne: 'Select One...',
setAsDefault: 'Set as default',
titleRequired: 'Title is required.',
userAddressAddSuccess: 'New address was added successfully!',
userAddressUpdateSuccess: 'Address updated successfully!',
userAddressDeleteSuccess: 'Address deleted successfully!',
invalidAddress: 'Invalid Address',
},
addressBook: {
addNewShippingAddress: 'Add a new shipping address',
editShippingAddress: 'Edit shipping address',
areYouSureToDeleteAddress: 'Are you sure you want to delete this address?',
addNewAddress: 'Add new address',
addAddress: 'Add address',
updateAddress: 'Update address',
backToAddressList: 'Back to address list',
},
addressCard: {
default: 'DEFAULT',
selected: 'Selected',
setAsDefault: 'Set as default',
shipTo: 'Ship To',
billTo: 'Bill To',
},
};
28 changes: 28 additions & 0 deletions projects/assets/src/translations/zh/cart.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export const cart = {
cartDetails: {
id: 'ID',
proceedToCheckout: 'Proceed to Checkout',
cartName: 'Cart #{{code}}',
},
cartItems: {
id: 'ID',
description: 'Description',
item: 'Item',
itemPrice: 'Item price',
quantity: 'Qty',
quantityTitle:
'The quantity represents the total number of this item in your cart.',
total: 'Total',
cartTotal: 'Cart total ({{count}} item)',
cartTotal_plural: 'Cart total ({{count}} items)',
},
orderCost: {
orderSummary: 'Order Summary',
subtotal: 'Subtotal after discounts:',
estimatedShipping: 'Estimated shipping:',
discount: 'You saved:',
salesTax: 'Sales Tax:',
grossTax: 'The order total does not include tax of',
total: 'Total:',
},
};
46 changes: 46 additions & 0 deletions projects/assets/src/translations/zh/checkout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export const checkout = {
checkoutAddress: {
shippingAddress: 'Shipping Address',
selectYourShippingAddress: 'Select your Shipping Address',
defaultShippingAddress: 'Default Shipping Address',
verifyYourAddress: 'Verify your address',
ensureAccuracySuggestChange:
'To ensure delivery accuracy, we suggest the change selected below.',
chooseAddressToUse: 'Please choose which address you would like to use:',
suggestedAddress: 'Suggested address',
enteredAddress: 'Entered address',
addNewAddress: 'Add New Address',
shipToThisAddress: 'Ship to this address',
editAddress: 'Edit address',
saveAddress: 'Save address',
},
checkoutOrderConfirmation: {
confirmationOfOrder: 'Confirmation of Order:',
thankYou: 'Thank you for your order!',
invoiceHasBeenSentByEmail:
'An invoice has been sent by email. You should receive it soon.',
orderItems: 'Order Items',
orderPlacedSuccessfully: 'Order placed successfully',
},
checkoutReview: {
review: 'Review',
orderItems: 'Order Items',
confirmThatRead: 'I am confirming that I have read and agreed with the',
placeOrder: 'Place Order',
termsAndConditions: 'Terms & Conditions',
},
checkoutShipping: {
shippingMethod: 'Shipping Method',
standardDelivery: 'Standard Delivery',
premiumDelivery: 'Premium Delivery',
},
checkout: {
backToCart: 'Back to cart',
},
checkoutProgress: {
shippingAddress: 'Shipping Address',
deliveryMode: 'Delivery mode',
paymentDetails: 'Payment details',
reviewOrder: 'Review order',
},
};
100 changes: 100 additions & 0 deletions projects/assets/src/translations/zh/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
export const common = {
common: {
cancel: 'Cancel',
delete: 'Delete',
remove: 'Remove',
edit: 'Edit',
back: 'Back',
submit: 'Submit',
continue: 'Continue',
save: 'Save',
done: 'Done',
home: 'Home',
},
pageMetaResolver: {
category: {
title: '{{count}} result for {{query}}',
title_plural: '{{count}} results for {{query}}',
},
checkout: {
title: 'Checkout {{count}} item',
title_plural: 'Checkout {{count}} items',
},
search: {
title: '{{count}} result for "{{query}}"',
title_plural: '{{count}} results for "{{query}}"',
},
product: {
description: '{{description}}',
heading: '{{heading}}',
title: '{{title}}',
},
},
spinner: {
loading: 'Loading...',
},
navigation: {
shopAll: 'Shop all {{ navNode}} >',
},
searchBox: {
placeholder: 'Search here...',
help: {
insufficientChars: 'Please type more characters',
noMatch: 'We could not find any results',
exactMatch: '{{ term }}',
empty: 'Ask us anything',
},
},
sorting: {
date: 'Date',
orderNumber: 'Order Number',
},
httpHandlers: {
badGateway: 'A server error occurred. Please try again later.',
badRequestPleaseLoginAgain: '{{ errorMessage }}. Please login again.',
badRequestOldPasswordIncorrect: 'Old password incorrect.',
conflict: 'Already exists',
forbidden: 'You are not authorized to perform this action.',
gatewayTimeout: 'The server did not responded, please try again later.',
unknownError: 'An unknown error occurred',
validationErrors: {
missing: {
card_cardType:
'The credit card selected is not supported. Please select another.',
card_accountNumber: 'The credit card number entered is not valid.',
card_cvNumber: 'The security code entered is not valid.',
card_expirationMonth:
'The credit card expiration date entered is not valid.',
card_expirationYear:
'The credit card expiration date entered is not valid.',
billTo_firstName: 'The first name entered is not valid.',
billTo_lastName: 'The last name entered is not valid.',
billTo_street1: 'The address entered is not valid.',
billTo_street2: 'The address entered is not valid.',
billTo_city: 'The city entered is not valid for this credit card.',
billTo_state:
'The state/province entered is not valid for this credit card.',
billTo_country:
'The country entered is not valid for this credit card.',
billTo_postalCode:
'The zip/postal code is not valid for this credit card.',
country: {
isocode: 'Missing country',
},
},
invalid: {
card_expirationMonth:
'The credit card expiration date entered is not valid.',
},
},
cartNotFound: 'Cart not found.',
},
miniCart: {
item: '{{count}} item currently in your cart',
item_plural: '{{count}} items currently in your cart',
},
miniLogin: {
userGreeting: 'Hi, {{name}}',
signInRegister: 'Sign In / Register',
},
};
23 changes: 23 additions & 0 deletions projects/assets/src/translations/zh/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { cart } from './cart';
import { checkout } from './checkout';
import { common } from './common';
import { myAccount } from './my-account';
import { product } from './product';
import { pwa } from './pwa';
import { storeFinder } from './store-finder';
import { user } from './user';
import { payment } from './payment';
import { address } from './address';

export const zh = {
address,
cart,
checkout,
common,
myAccount,
payment,
product,
pwa,
storeFinder,
user,
};
99 changes: 99 additions & 0 deletions projects/assets/src/translations/zh/my-account.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
export const myAccount = {
orderDetails: {
orderId: 'Order #',
placed: 'Placed',
status: 'Status',
shippedOn: 'Shipped on',
inProcess: 'In process...',
pending: 'Pending',
deliveryStatus_READY_FOR_PICKUP: 'Ready for pickup',
deliveryStatus_PICKUP_COMPLETE: 'Picked up',
deliveryStatus_SHIPPED: 'Shipped',
deliveryStatus_CANCELLED: 'Cancelled',
statusDisplay_cancelled: 'Cancelled',
statusDisplay_cancelling: 'Cancel Pending',
statusDisplay_completed: 'Completed',
statusDisplay_created: 'Created',
statusDisplay_error: 'Pending',
statusDisplay_Error: 'Pending',
statusDisplay_open: 'Open',
statusDisplay_processing: 'In Process',
},
orderHistory: {
orderHistory: 'Order history',
orderId: 'Order #',
date: 'Date',
status: 'Status',
total: 'Total',
noOrders: 'We have no order records for this account.',
startShopping: 'Start Shopping',
sortByMostRecent: 'Sort by Most recent',
},
closeAccount: {
confirmAccountClosure: 'Confirm Account Closure',
confirmAccountClosureMessage:
'Are you sure you want to close your account?',
closeMyAccount: 'CLOSE MY ACCOUNT',
accountClosedSuccessfully: 'Account closed with success',
},
updateEmailForm: {
newEmailAddress: {
label: 'New email address',
placeholder: 'Enter email',
},
confirmNewEmailAddress: {
label: 'Confirm new email address',
placeholder: 'Enter email',
},
enterValidEmail: 'Please enter a valid email.',
bothEmailMustMatch: 'Both emails must match',
password: {
label: 'Password',
placeholder: 'Enter password',
},
pleaseInputPassword: 'Please input password',
emailUpdateSuccess: 'Success. Please sign in with {{ newUid }}',
},
updatePasswordForm: {
oldPassword: {
label: 'Old Password',
placeholder: 'Old Password',
},
oldPasswordIsRequired: 'Old password is required.',
newPassword: {
label: 'New Password',
placeholder: 'New Password',
},
passwordMinRequirements:
'Password must be six characters minimum, with one uppercase letter, one number, one symbol',
confirmPassword: {
label: 'Confirm New Password',
placeholder: 'Confirm Password',
},
bothPasswordMustMatch: 'Both password must match',
passwordUpdateSuccess: 'Password updated with success',
},
updateProfileForm: {
title: '',
none: '',
firstName: {
label: 'First name',
placeholder: 'First name',
},
firstNameIsRequired: 'First name is required.',
lastName: {
label: 'Last name',
placeholder: 'Last name',
},
lastNameIsRequired: 'Last name is required.',
profileUpdateSuccess: 'Personal details successfully updated',
},
consentManagementForm: {
message: {
success: {
given: 'Consent successfully given.',
withdrawn: 'Consent successfully withdrawn.',
},
},
},
};
Loading

0 comments on commit f17883e

Please sign in to comment.