英文:
how to find unlocalized strings in flutter/ easy_localization
问题
最近我们在Flutter中使用easy_localization包完成了一个大型应用程序,但现在我需要检查项目中是否有任何不遵循该包规则并且在不同语言环境下不兼容的字符串?
错误的模式:
"str"
'str'
正确的模式:
tr("str")
tr('str')
英文:
Recently we complete a huge application with easy_localization package in flutter
but now I need to check is there any string in project that dose not follow this package rules and not compatible in different locales?
wrong pattern:
"str"
'str'
correct pattern
tr("str")
tr('str')
答案1
得分: 0
我用以下两个正则表达式解决了这个问题:
[^(]"[^)]
[^(]'[^)]
可以在 regex101 上进行测试和改进。
你可以像这样在 VS Code 中使用它来查找它们:
英文:
I solved this issue with these two regular expressions:
[^(]".*"[^)]
[^(]'.*'[^)]
that can be tested and improved in regex101
you can use it in vs code like this to find them
If you know better way or expression to solve it
please inform me at comments
答案2
得分: 0
你可以使用编辑器在项目中搜索与"str"匹配的内容,并自行确认。
我对正则表达式不是很擅长,但我认为这个表达式可以实现:[^(]".*"[^)]
英文:
you can just search your project for anything that matches "str" using your editor and confirm it yourself
I'm not that good at regex but I think this will do it [^(]".*"[^)]
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论