无法使用getx在颤动中使用value翻译文本
问题在于文本的价值在文本前一天声明 因此,idk如何翻译包含值的文本。
untilEventDay =
'${pDate.difference(DateTime.now()).inDays},days/ until event day'
.tr;
在翻译页面中:
,days/ until next event day': 'ڕؤژ ماوه/ تاوهكو ئیڤێنتی داهاتوو',
the problem is that the text has value which declares the day before the text
so idk how to translate this text that includes value.
untilEventDay =
'${pDate.difference(DateTime.now()).inDays},days/ until event day'
.tr;
in translation page :
,days/ until next event day': 'ڕؤژ ماوه/ تاوهكو ئیڤێنتی داهاتوو',
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将值的字符串与翻译分开
,如果您需要使用特定语言的日常数字,则可以使用地图或辅助方法。地图解决方案将是这样的东西:
然后在字符串中使用它:
重要:要拥有一个清洁的代码,您可以创建一个辅助方法来生成所需的字符串,然后将其称为文本widtet 。这样的代码将更可以理解。 此外,您可以添加处理任何条件,这些条件以后可能会添加到字符串生成器中。就像是最后一天一样,写其他东西,而不是剩余0天。
ps。您的问题的标题是错误的,您应该将其更改为您在标题中的解释
you should separate the value's string from your translation
and if you need your day number to be in a specific language, you can use a map or a helper method. map solution would be something like this:
and then use it in your string :
Important: to have a cleaner code, you can create a helper method to generate your desired string, and call it in your text widget. the code would be more understandable that way. Also, you can add handle any conditions that may later be added to the string generator. like if it's the last day, write something else instead of 0 days remaining.
ps. your question's title is wrong, you should change it to what you're explaining in the caption