Open ottopic opened 2 years ago
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:
and after setting
<key>CFBundleDevelopmentRegion</key>
<string>de_DE</string>
in tiapp.xml I had German strings.
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.
Update:
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,
});
I have searched and made sure there are no existing issues for the issue I am filing
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
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