Giter Club home page Giter Club logo

Comments (18)

fjqingyou avatar fjqingyou commented on August 17, 2024 1

from potplayer_subtitle_translate_baidu.

squanbo avatar squanbo commented on August 17, 2024

您好,我现在有了新的解决方案,我在有翻译的字幕中都添加了"《 B R 》"(换行符),所以现在剩下的问题就是进行一个判断,在text(原文)中寻找"《BR》",如果找到返回1否则返回负数,我阅读了angelscript的开发者文档,但是仍不会编写,报函数错误(太菜了),请问该如何编写呢?谢谢!(用中文 《 的原因是github会把《BR》识别成换行符)

from potplayer_subtitle_translate_baidu.

fjqingyou avatar fjqingyou commented on August 17, 2024

字符串是 potplaty 自己封装的
并不确定它提供了啥方法。。
不过字符串本质是连续一串字符串长度+\0结尾的内存。

所以

         //字符串[索引偏移] == 目标字符
        string strTest = "abcdefg";
        //strTest[0] == "a"[0] 
        //strTest[2] == "c"[0]

有必要的话,完全可以自己封装一个 strstr 的函数实现你的功能

from potplayer_subtitle_translate_baidu.

squanbo avatar squanbo commented on August 17, 2024

好的,我自己在里面添加了几行代码,添加在了Translate的函数下面,编译通过了,但是没有实现相应的功能,能请您帮忙看看吗?谢谢!
image
image

string strTest="
";
for(int i = 0;i < srcLang.length();i++){
if(text[i] == strTest[0]){
if(text[i+1] == strTest[1]){
if(text[i+2] == strTest[2]){
ret = " ";
}
else{ }
}
else{ }
}
else{ }
}

from potplayer_subtitle_translate_baidu.

fjqingyou avatar fjqingyou commented on August 17, 2024

from potplayer_subtitle_translate_baidu.

fjqingyou avatar fjqingyou commented on August 17, 2024

而且要查找的字符不应该是不是四个?才3
个if不够吧

from potplayer_subtitle_translate_baidu.

squanbo avatar squanbo commented on August 17, 2024

好的,我明白了,我已经在c的编译器里测试过新改的代码了,但是在脚本里,一直报这个错误
image
我觉得是没有包含头文件造成的,但是,头文件写在哪林,哪里就报错'Unexpected token ''
请问如何修改呢?谢谢!

from potplayer_subtitle_translate_baidu.

squanbo avatar squanbo commented on August 17, 2024

char b[4]="
";
int i;
for(i = 0;i < srcLang.length();i++){
if(text[i] == b[0]){
if(text[i+1] == b[1]){
if(text[i+2] == b[2]){
if(text[i+3] == b[3]){
ret = " ";
break;
}
}
}
}
}
这是修改后的代码,ret返回空值是因为您下面标注了这句话的作用
image所以才这样子用的,谢谢!

from potplayer_subtitle_translate_baidu.

squanbo avatar squanbo commented on August 17, 2024

image
image
这是在dev中跑成功的代码

from potplayer_subtitle_translate_baidu.

fjqingyou avatar fjqingyou commented on August 17, 2024

截图没提到的报错信息,唯有分号,b变量重复定义的错误

不建议c在vs里面写,因为不使用include编译指令,一些内置c函数vs能跑,potplayer不能跑。

from potplayer_subtitle_translate_baidu.

squanbo avatar squanbo commented on August 17, 2024

嗯嗯。。发现了。。但是b没有重复定义,也没少 ; 。我换了一个变量,也是报同样的错误,只有第一版是没有任何报错的。。

from potplayer_subtitle_translate_baidu.

squanbo avatar squanbo commented on August 17, 2024

我看您上面用string定义字符串,但是我没有用过,之前是复制过来改的,所以也不知道具体的作用。。

from potplayer_subtitle_translate_baidu.

fjqingyou avatar fjqingyou commented on August 17, 2024

from potplayer_subtitle_translate_baidu.

fjqingyou avatar fjqingyou commented on August 17, 2024

from potplayer_subtitle_translate_baidu.

squanbo avatar squanbo commented on August 17, 2024

我这样修改了一下,不报错了,但是功能还是没有实现。。还是会再翻译一遍
string Translatetest1="
";
int i;
for(i = 0;i < srcLang.length();i++){
if(text[i] == Translatetest1[0]){
if(text[i+1] == Translatetest1[1]){
if(text[i+2] == Translatetest1[2]){
if(text[i+3] == Translatetest1[3]){
ret = " ";
break;
}
}
}
}
}

from potplayer_subtitle_translate_baidu.

squanbo avatar squanbo commented on August 17, 2024

而且同样的代码在英文字幕中就可以发挥作用但是日语环境就不行
image
image

from potplayer_subtitle_translate_baidu.

fjqingyou avatar fjqingyou commented on August 17, 2024

from potplayer_subtitle_translate_baidu.

fjqingyou avatar fjqingyou commented on August 17, 2024

from potplayer_subtitle_translate_baidu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.