Skip to content

Commit

Permalink
deps: add v8::Isolate::GetDefaultLocale()
Browse files Browse the repository at this point in the history
  • Loading branch information
joyeecheung committed Aug 9, 2024
1 parent 9e6c526 commit 07af2f1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions deps/v8/include/v8-isolate.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <stdint.h>

#include <memory>
#include <string>
#include <utility>

#include "cppgc/common.h"
Expand Down Expand Up @@ -1711,6 +1712,12 @@ class V8_EXPORT Isolate {
*/
void LocaleConfigurationChangeNotification();

/**
* Returns the default locale in a string if Intl support is enabled.
* Otherwise returns an empty string.
*/
std::string GetDefaultLocale();

Isolate() = delete;
~Isolate() = delete;
Isolate(const Isolate&) = delete;
Expand Down
11 changes: 11 additions & 0 deletions deps/v8/src/api/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10577,6 +10577,17 @@ void v8::Isolate::LocaleConfigurationChangeNotification() {
#endif // V8_INTL_SUPPORT
}

std::string Isolate::GetDefaultLocale() {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(this);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);

#ifdef V8_INTL_SUPPORT
return i_isolate->DefaultLocale();
#else
return std::string();
#endif
}

#if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING)
void Isolate::SetFilterETWSessionByURLCallback(
FilterETWSessionByURLCallback callback) {
Expand Down

0 comments on commit 07af2f1

Please sign in to comment.