Open Rianu opened 3 years ago
Is the locale
prop using ja
as the name
key? It may help to paste that object here for analysis. You can truncate it if it's too long.
Here you go scrollingCalendar: { name: "ja", config: { months: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split( "_" ), monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split( "_" ), weekdays: "日曜日_月曜_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"), weekdaysShort: "日曜日_月曜_火曜日_水曜日_木曜日_金曜日_土曜日".split( "_" ), weekdaysMin: "日曜日_月曜_火曜日_水曜日_木曜日_金曜日_土曜日".split( "_" ), longDateFormat: { LT: "HH:mm", LTS: "HH:mm:ss", L: "DD/MM/YYYY", LL: "D MMMM YYYY", LLL: "D MMMM YYYY LT", LLLL: "dddd D MMMM YYYY LT", }, calendar: { sameDay: "今日", }, week: { dow: 1, // Monday is the first day of the week. doy: 1, // The week that contains Jan 4th is the first week of the year. }, }, },
"scrollingCalendar" is passed into the locale prop in calendar strip.
That config looks correct. Your app needs to call the locale()
method to activate the language. See #232
Thanks for the quick reply. I do believe I that is set in my app.js file. That’s how I localize for this app. I will post the code tomorrow to verify it’s correct.
I import my moment modules as follows:
import moment from "moment"; import "moment/locale/ja";
and call the moment.locale() method here as in the linked issue:
let appLocale = NativeModules.SettingsManager.settings.AppleLocale || NativeModules.SettingsManager.settings.AppleLanguages[0];
// remove country portion of locale if (appLocale.indexOf("") > 0) appLocale = appLocale.split("")[0];
console.log("appLocale: " + appLocale);
moment.locale(appLocale); LocalizationConfig(appLocale);
Anything I'm missing here? This works great in simulation mode.
NOTE: I did hardcode "ja" in moment.locale() and LocalizationConfig since I cannot get the app locale because I'm in NA. It still doesn't work.
I'm still having issues with making localization work in production (iOS). I've followed the instructions to the T in the guide. I have:
import 'moment'; import 'moment/locale/ja'
in my index.js file and the moment initialized in app.js and set everywhere in the app. I configured my localization object with the localization strings and I set the locale in the calendar strip component. It works perfectly in development, but when deployed the app crashes immediately. If I just leave it as english it works just fine. I'm not sure how much code I can show since this isn't shareable but I can do best I can if there's something specific you would like to see.
Any tips? I'd really like this in calendar in japanese to work in production. It looks great in development.