woocommerce / woocommerce-ios

WooCommerce iOS app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
298 stars 110 forks source link

Strings half localized #1164

Closed pmusolino closed 5 years ago

pmusolino commented 5 years ago

I discovered two strings that are half localized, in two different languages at the same time. This problem affects all localisations.

1) I encountered on order detail a string that is half localized. Payment of 80,00€ received via Bonifico bancario it’s half in English and half in Italian. 2) Another string with the same problem it's inside notifications panel, on a new order. (see attachment screenshots). The bug's always present, in any language.

How to solve:

1) About the first case, I noticed that in the English Localizable.strings there are two sentences

/* Payment of <currency symbol><payment total> received via (payment method title) */
"Payment of \(subject.totalValue) received via \(order.paymentMethodTitle)" = "Payment of \(subject.totalValue) received via \(order.paymentMethodTitle)";

/* Payment of <currency symbol><payment total> received via (payment method title) */
"Payment of \(totalValue) received via \(order.paymentMethodTitle)" = "Payment of \(totalValue) received via \(order.paymentMethodTitle)";

But in other Localizable files (any language) the first sentence it's not present.

2) The second case is managed from the server that sends the content of the push notification, but it's not localized.

Screenshots:

IMG_5090 IMG_5091

Mobile Environment

mindgraffiti commented 5 years ago

@jtreanor could the first case be a problem with our localization script? The payment received string hasn't been modified for quite a while. (Ignore the second one, it's a server-side issue)

mindgraffiti commented 5 years ago

Nevermind @jtreanor, I figured it out. Looks like I used string interpolation somewhere in the code for the first problem listed above.

jtreanor commented 5 years ago

Ah, that makes sense. Let me know if there is anything else I can help with here @mindgraffiti.

mindgraffiti commented 5 years ago

Issue 1: find the localized string in the code (probably in OrderDetailsViewModel) and ensure it's not using string interpolation. Use the String.localizeStringWithFormat() method instead.

Ref. p77Llu-bLz-p2

Issue 2: afaik, the server-side push notifications have never been localized. Part of completing this ticket should include finding where to file "Localization missing in push notifications" bug.

mindgraffiti commented 5 years ago

Issue 1 should be solved during the implementation of #1090

mindgraffiti commented 5 years ago

Issue 2: The API request is:

https://public-api.wordpress.com/rest/v1.1/notifications?fields=id%2Cnote_hash&number=100

If it is localized, I bet it's based on the user's WordPress settings.

mindgraffiti commented 5 years ago

Ref. p99K0U-1Fc-p2