如何在Flutter的easy_localization中查找未本地化的字符串。

huangapple go评论73阅读模式
英文:

how to find unlocalized strings in flutter/ easy_localization

问题

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')
英文:

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中像这样使用它们来查找:

如何在Flutter的easy_localization中查找未本地化的字符串。

如果你知道更好的方法或表达式来解决这个问题,请在评论中告诉我。

英文:

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

如何在Flutter的easy_localization中查找未本地化的字符串。
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 [^(]".*"[^)]

huangapple
  • 本文由 发表于 2023年8月9日 16:32:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76865935-2.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定