titanium-sdk icon indicating copy to clipboard operation
titanium-sdk copied to clipboard

Titanium.UI.PICKER_TYPE_DATE wrong language on distribution

Open ottopic opened this issue 1 year ago • 4 comments

I have searched and made sure there are no existing issues for the issue I am filing

  • [X] I have searched the existing issues

Description

Opening picker with type PICKER_TYPE_DATE names of months and days are in english in production version. In simulator are in correct locale language. Second problem, names of days are cutted

simulator

production

Expected Behavior

Correct locale language in production too

Actual behavior

Calendar translated in english

Reproducible sample

Ti.UI.createPicker({ type:Ti.UI.PICKER_TYPE_DATE, top:50 })

Steps to reproduce

Open picker

Platform

iOS

SDK version you are using

10.1.1.GA

Alloy version you are using

No response

ottopic avatar Jul 05 '22 10:07 ottopic

Using this demo code:


let navigationWindow = null;
const parentWindow = Ti.UI.createWindow({ title: "Parent Window" });
const openButton = Ti.UI.createButton({ title: "Show Date Picker" });
openButton.addEventListener("click", () => {
	const dialog = Ti.UI.createOptionDialog({
		title: "Select Picker Style",
		options: ["Automatic", "Compact", "Inline", "Wheels"],
	});
	dialog.addEventListener("click", (e) => {
		let datePickerStyle;
		switch (e.index) {
			case 0: datePickerStyle = Ti.UI.DATE_PICKER_STYLE_AUTOMATIC; break;
			case 1: datePickerStyle = Ti.UI.DATE_PICKER_STYLE_COMPACT; break;
			case 2: datePickerStyle = Ti.UI.DATE_PICKER_STYLE_INLINE; break;
			case 3: datePickerStyle = Ti.UI.DATE_PICKER_STYLE_WHEELS; break;
			default: return;
		}
		const childWindow = Ti.UI.createWindow({ title: "Select Date" });
		const picker = Ti.UI.createPicker({
			type: Ti.UI.PICKER_TYPE_DATE,
			datePickerStyle: datePickerStyle,
		});
		picker.addEventListener("change", (e) => {
			console.log("@@@ e.value: " + e.value);
		});
		childWindow.add(picker);
		const button = Ti.UI.createButton({
			title: "Get Selected Date",
			bottom: "40dp",
		});
		button.addEventListener("click", () => {
			alert(`Selected Date: ${picker.value}`);
		});
		childWindow.add(button);
		navigationWindow.openWindow(childWindow, { animated: true });
	});
	dialog.show();
});
parentWindow.add(openButton);
navigationWindow = Ti.UI.createNavigationWindow({
	window: parentWindow,
});
navigationWindow.open();

I don't see any cut of texts on my phone: IMG_0011

and after setting

<key>CFBundleDevelopmentRegion</key>
<string>de_DE</string>

in tiapp.xml I had German strings.

m1ga avatar Jul 05 '22 17:07 m1ga

Language problems are only in production app, in development builds days and months are in correct language. About cut text I will check better my code.

ottopic avatar Jul 12 '22 08:07 ottopic

Update:

  • fixed cutted text in my code.
  • production problem of calendar translation confirmed

ottopic avatar Jul 13 '22 09:07 ottopic

Can you double check that your device AND the app are in your desired language? Since iOS 13, it is possible to override the system locale per app (when scrolling down to your app in your system settings and select a custom language). We don't override the calendar locale manually, so it uses the default:

@property (nullable, nonatomic, strong) NSLocale   *locale;   // default is [NSLocale currentLocale]. setting nil returns to default

But you can set a custom locale to the picker using the locale string variable, e.g.:

const picker = Ti.UI.createPicker({
    type: Ti.UI.PICKER_TYPE_DATE,
    locale: 'de',
    datePickerStyle: datePickerStyle,
});

hansemannn avatar Jul 14 '22 13:07 hansemannn