Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android V8 does'n support \p Regexp. #17006

Open
smallmain opened this issue May 17, 2024 · 12 comments
Open

Android V8 does'n support \p Regexp. #17006

smallmain opened this issue May 17, 2024 · 12 comments
Assignees
Labels
Bug Env: Native General issue on all native platforms including iOS, Android, MacOS, Windows

Comments

@smallmain
Copy link

Cocos Creator version

3.8.2

System information

MacOS

Issue description

It may be related to this: https://nodejs.org/dist/latest-v17.x/docs/api/intl.html#internationalization-support

image

Relevant error log output

No response

Steps to reproduce

.

Minimal reproduction project

No response

@smallmain smallmain added Bug Needs Triage Needs to be assigned by the team labels May 17, 2024
@minggo
Copy link
Contributor

minggo commented May 24, 2024

It may be related to this: https://nodejs.org/dist/latest-v17.x/docs/api/intl.html#internationalization-support

I don't understand why regular expression is related to internationalization.

@smallmain
Copy link
Author

smallmain commented May 24, 2024

它可能与此相关:https://nodejs.org/dist/latest-v17.x/docs/api/intl.html#internationalization-support

我不明白为什么正则表达式与国际化相关。

image

Since RegExp Unicode Property Escapes are matched in a language-aware way, which requires ICU data (International Components for Unicode), which can be optionally included in NodeJS builds, So I suspect that Cocos' V8 builds don't include this data, since it works fine on other platforms.

https://github.com/tc39/proposal-regexp-unicode-property-escapes

And, theoretically, all the functions listed in the table should not work in their entirety without including this data.

@minggo
Copy link
Contributor

minggo commented May 24, 2024

Got it, thanks.

Yep, the ICU module is not included in v8 to reduce size. We will take a look how to provide it.

@smallmain
Copy link
Author

Got it, thanks.

Yep, the ICU module is not included in v8 to reduce size. We will take a look how to provide it.

RegExp's Unicode support is very important. If you want to correctly segment Chinese words, Emoji, etc., this is the simplest and most correct method. If the engine does not support it, the user also needs to increase the size of the polyfill.

Hope it gets taken seriously.

@minggo
Copy link
Contributor

minggo commented May 24, 2024

Sure, we will resolve it.

@dumganhar dumganhar self-assigned this Jun 12, 2024
@dumganhar
Copy link
Contributor

dumganhar commented Jun 12, 2024

I built the same v8 version used in cocos creator 3.8.3, its size will increase 4MB (zip packed in APK) or 10MB (so size, not packed). I think only some people need this functionality. So I don't suggest to include v8 with INTL by default.
WeChatb814ccd88f65032510148c8f716d2bd8

You could download the v8 with INTL support here ( https://github.com/cocos/v8/releases/tag/11.6.189.22-intl-support ) and replace the libv8_monolith.a in engine/native/external directory.

I will write a documentation about how to enable v8 INTL support.

@dumganhar dumganhar added Env: Native General issue on all native platforms including iOS, Android, MacOS, Windows and removed Needs Triage Needs to be assigned by the team labels Jun 12, 2024
@smallmain
Copy link
Author

smallmain commented Jun 12, 2024

I built the same v8 version used in cocos creator 3.8.3, its size will increase 4MB (zip packed in APK) or 10MB (so size, not packed). I think only some people need this functionality. So I don't suggest to include v8 with INTL by default. WeChatb814ccd88f65032510148c8f716d2bd8

You could download the v8 with INTL support here ( https://github.com/cocos/v8/releases/tag/11.6.189.22-intl-support ) and replace the libv8_monolith.a in engine/native/external directory.

I will write a documentation about how to enable v8 INTL support.

Can you add a option to build panel?

@dumganhar
Copy link
Contributor

dumganhar commented Jun 12, 2024

Can you add a option to build panel?

It will be more work to do.

  1. [developing] Add a UI item in build panel to switch v8 with or without INTL support
  2. [developing] CMake file should be updated to link different libv8_monolith.a
  3. [testing] Test work for QA team on each platform will be doubled

If there're many developers need this functionality, we will consider to add a radio button for easier switching v8 with or without INTL support.

@minggo What's your opinion?

@minggo
Copy link
Contributor

minggo commented Jun 12, 2024

I agree with @dumganhar . It may take more resource to add a new feature. Especially we should make every new feature work correctly on all platforms for every version.

@smallmain
Copy link
Author

smallmain commented Jun 12, 2024

I agree with @dumganhar . It may take more resource to add a new feature. Especially we should make every new feature work correctly on all platforms for every version.

@minggo @dumganhar

我们不是有扩展和实验室机制吗?
Don't we have extensions and lab mechanisms?

我们既然能通过扩展发布了 shader-graphl10n 这两个 BUG 非常多、可用性不高的功能,通过实验室发布几乎不可用和很难用的 原生引擎场景,那么我觉得就应该利用这两个机制提高我们引擎特性的迭代速度,将 [testing] 环节完全简化或去除。
Now that we've been able to release 'shader-graph' and 'l10n' buggier and less usable features through extensions, and release 'native engine scenes' that are almost impossible and difficult to use through LABS, I think we should use these two mechanisms to improve the speed of feature iteration. Simplify or remove [testing] entirely.

当然,这个 Intl 貌似只有我反馈,虽然我很惊讶,但可能确实 Cocos 开发者大部分都没完善的国际化支持需求,仅提供文档我可以理解。
Of course, this' Intl 'seems to be my only feedback, and while I'm surprised, it's probably true that most Cocos developers don't need this.

@minggo
Copy link
Contributor

minggo commented Jun 12, 2024

Don't we have extensions and lab mechanisms?

Extension and lab mechanism is used for the feature that we want to support but it is not ready. And we want to reduce it as few as possible.

Of course, this' Intl 'seems to be my only feedback, and while I'm surprised, it's probably true that most Cocos developers don't need this.

We will support in when more developers need it.

@luke886688
Copy link

luke886688 commented Aug 29, 2024

我构建了与 cocos creator 3.8.3 中使用的相同的 v8 版本,其大小将增加 4MB(zip 打包在 APK 中)或 10MB(因此是大小,而不是打包)。我认为只有一些人需要此功能。所以我不建议默认包含v8 with INTL微信b814ccd88f65032510148c8f716d2bd8

您可以在此处下载支持 INTL 的 v8(https://github.com/cocos/v8/releases/tag/11.6.189.22-intl-support)并替换`libv8_monolith.a`engine/native/external 目录中的版本。

我将编写一份有关如何启用 v8 INTL 支持的文档。

@dumganhar
你好,麻烦问下,这个如何启用v8 Intl支持的文档在哪个地方呢?我这边需要使用Intl API ,支持国际化操作,我这边按照你上面提供的方法,我全部替换了,但是在原生Android 上还是报错提示:/3d/engine/native/cocos/bindings/jswrapper/v8/Object.cpp, 754): Invoking function failed, ReferenceError: Intl is not defined ,我把
image
这里所有的libv8_monolith.a全部替换了支持INTL的,然后把include/v8下面的代码也全部替换了,并切换到cocos creator3.8.2中执行了引擎编译,最终在构建原生android,还是报错,提示没有Intl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Env: Native General issue on all native platforms including iOS, Android, MacOS, Windows
Projects
None yet
Development

No branches or pull requests

4 participants