1e41f4b71Sopenharmony_ci# User Preference Setting (for System Applications Only) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## Use Cases 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ciIn addition to system locales and application preferred languages, the system supports setting of user preferences. Currently, the system supports two user preferences: whether to use local digits and whether to use the 12/24-hour format. User preference settings are saved to system locales and application preferred languages as part of the internationalization feature. 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ci## How to Develop 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ciFor details about how to use the APIs, see [setUsingLocalDigit](../reference/apis-localization-kit/js-apis-i18n-sys.md#setusinglocaldigit9) and [set24HourClock](../reference/apis-localization-kit/js-apis-i18n-sys.md#set24hourclock9). 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci1. Import the **intl** module. 13e41f4b71Sopenharmony_ci ```ts 14e41f4b71Sopenharmony_ci import { i18n, intl } from '@kit.LocalizationKit'; 15e41f4b71Sopenharmony_ci import { BusinessError } from '@kit.BasicServicesKit'; 16e41f4b71Sopenharmony_ci ``` 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci2. Obtain the preferred language of an application. 19e41f4b71Sopenharmony_ci ```ts 20e41f4b71Sopenharmony_ci // Obtain the preferred language of an application. 21e41f4b71Sopenharmony_ci let appPreferredLanguage: string = i18n.System.getAppPreferredLanguage(); 22e41f4b71Sopenharmony_ci ``` 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci3. Enable display of local digits on the application page. 25e41f4b71Sopenharmony_ci ```ts 26e41f4b71Sopenharmony_ci try { 27e41f4b71Sopenharmony_ci i18n.System.setUsingLocalDigit(true); // Enable the local digit switch. 28e41f4b71Sopenharmony_ci } catch(error) { 29e41f4b71Sopenharmony_ci let err: BusinessError = error as BusinessError; 30e41f4b71Sopenharmony_ci console.error(`call System.setUsingLocalDigit failed, error code: ${err.code}, message: ${err.message}.`); 31e41f4b71Sopenharmony_ci } 32e41f4b71Sopenharmony_ci let date = new Date(2023, 9, 25); 33e41f4b71Sopenharmony_ci let appPreferredLanguage = "ar"; 34e41f4b71Sopenharmony_ci let dateTimeFmt = new intl.DateTimeFormat(appPreferredLanguage); 35e41f4b71Sopenharmony_ci let result = dateTimeFmt.format(date); // result = "٢٠٢٣/١٠/٢٥" (local Arabic digits) 36e41f4b71Sopenharmony_ci ``` 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci4. Set the 24-hour clock format. 39e41f4b71Sopenharmony_ci ```ts 40e41f4b71Sopenharmony_ci try { 41e41f4b71Sopenharmony_ci i18n.System.set24HourClock(true); // true means to enable the 24-hour clock, and false means to enable the 12-hour clock. 42e41f4b71Sopenharmony_ci } catch(error) { 43e41f4b71Sopenharmony_ci let err: BusinessError = error as BusinessError; 44e41f4b71Sopenharmony_ci console.error(`call System.set24HourClock failed, error code: ${err.code}, message: ${err.message}.`); 45e41f4b71Sopenharmony_ci } 46e41f4b71Sopenharmony_ci let date = new Date(2023, 9, 25, 16, 48, 0); 47e41f4b71Sopenharmony_ci let appPreferredLanguage = "zh"; 48e41f4b71Sopenharmony_ci let dateTimeFmt = new intl.DateTimeFormat(appPreferredLanguage, { timeStyle: "medium" }); 49e41f4b71Sopenharmony_ci let result = dateTimeFmt.format(date); // result = "16:48:00" 50e41f4b71Sopenharmony_ci ``` 51