Skip to content

Commit c0ae793

Browse files
committed
Change the annotation to English
Signed-off-by: @wanghui187 <[email protected]>
1 parent 0fa73b7 commit c0ae793

File tree

3 files changed

+10
-10
lines changed
  • cocos/platform/ohos/napi/modules
  • tests
    • cpp-tests/proj.ohos/entry/src/main/ets/pages
    • lua-tests/project/proj.ohos/entry/src/main/ets/pages

3 files changed

+10
-10
lines changed

cocos/platform/ohos/napi/modules/InputNapi.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,25 +142,25 @@ napi_value InputNapi::textFieldTTFOnChangeCB(napi_env env, napi_callback_info in
142142
char text[2560] = {0};
143143
NAPI_CALL(env, napi_get_value_string_utf8(env, args[0], text, 2560, &textLen));
144144

145-
// 优化: 使用string_view避免不必要的字符串拷贝
145+
// Using string-view to avoid unnecessary string copying
146146
std::string_view oldView(oldContent);
147147
std::string_view newView(text, textLen);
148148

149-
// 找到第一个不同的字符位置
149+
// Find the first different character position
150150
size_t commonPrefixLen = 0;
151151
const size_t minLen = std::min(oldView.length(), newView.length());
152152
while (commonPrefixLen < minLen && oldView[commonPrefixLen] == newView[commonPrefixLen]) {
153153
commonPrefixLen++;
154154
}
155155

156-
// 删除差异后的旧内容字符
156+
// Delete old content characters after differences
157157
const size_t charsToDelete = oldView.length() - commonPrefixLen;
158158
const size_t deleteOperations = [&]() {
159159
size_t count = 0;
160160
size_t pos = oldView. length() - 1;
161161
size_t remaining = charsToDelete;
162162
while (remaining > 0) {
163-
// 检查UTF-8中文字符(0xE0-0xEF开头的3字节字符)
163+
// Check UTF-8 Chinese characters (3-byte characters starting with 0xE0-0xEF)
164164
bool isChineseChar = (pos >= 2 &&
165165
(unsigned char)oldView [pos-2] >= 0xE0 &&
166166
(unsigned char)oldView [pos-2] <= 0xEF);
@@ -170,12 +170,12 @@ napi_value InputNapi::textFieldTTFOnChangeCB(napi_env env, napi_callback_info in
170170
}
171171
return count;
172172
}();
173-
//批量删除字符
173+
// Batch delete characters
174174
for (size_t i = 0; i < deleteOperations; i++) {
175175
dispatcher->dispatchDeleteBackward();
176176
}
177177
const size_t insertLen = newView.length() - commonPrefixLen;
178-
// 插入差异后的新字符
178+
// Insert new characters after differences
179179
if ( insertLen > 0) {
180180
const char* newText = text + commonPrefixLen;
181181
CCLOG("textFieldTTFOnChangeCB: Inserting %zu characters: %s", insertLen, newText);

tests/cpp-tests/proj.ohos/entry/src/main/ets/pages/Index.ets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ struct Index {
7474
buttons: [
7575
{
7676
text: '取消',
77-
// 颜色可自定义
77+
// Color can be customized
7878
color: '#000000'
7979
},
8080
{
8181
text: '确认',
82-
// 颜色可自定义
82+
// Color can be customized
8383
color: '#000000'
8484
}
8585
],

tests/lua-tests/project/proj.ohos/entry/src/main/ets/pages/Index.ets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ struct Index {
7474
buttons: [
7575
{
7676
text: '取消',
77-
// 颜色可自定义
77+
// Color can be customized
7878
color: '#000000'
7979
},
8080
{
8181
text: '确认',
82-
// 颜色可自定义
82+
// Color can be customized
8383
color: '#000000'
8484
}
8585
],

0 commit comments

Comments
 (0)