feat(os): add locale API (#391)

This commit is contained in:
Lucas Fernandes Nogueira
2023-05-23 22:29:57 -03:00
committed by GitHub
parent 5676e77209
commit 7e3034904c
6 changed files with 43 additions and 3 deletions
+18 -1
View File
@@ -127,5 +127,22 @@ async function tempdir(): Promise<string> {
return window.__TAURI_INVOKE__("plugin:os|tempdir");
}
export { EOL, platform, version, type, arch, tempdir };
/**
* Returns a String with a `BCP-47` language tag inside. If the locale couldnt be obtained, `null` is returned instead.
* @example
* ```typescript
* import { locale } from '@tauri-apps/plugin-os';
* const locale = await locale();
* if (locale) {
* // use the locale string here
* }
* ```
*
* @since 2.0.0
*/
async function locale(): Promise<string | null> {
return window.__TAURI_INVOKE__("plugin:os|locale");
}
export { EOL, platform, version, type, arch, tempdir, locale };
export type { Platform, OsType, Arch };