mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
feat(os): add locale API (#391)
This commit is contained in:
@@ -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 couldn’t 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 };
|
||||
|
||||
Reference in New Issue
Block a user