TextTaable use HasFieldTextForLanguage if it is in other language,and the filed not wroten,it would get true

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
shortlin
Posts: 73
Joined: Wed Jun 03, 2020 1:52 am

TextTaable use HasFieldTextForLanguage if it is in other language,and the filed not wroten,it would get true

Post by shortlin »

As title,Is it normal?
I just want to check the textTable has it's own language filed in case that the translator forget to write the language filed.

So I checked this to use HasFieldTextForLanguage and let a test filed set some words in default language,the testing language not set any words.But using HasFieldTextForLanguage in testing language,it would return true.

Or just because using GetFieldTextForLanguage,it would get the default language's filed.so that's the reason HasFieldTextForLanguage judge true?

If it is.Could I check the textTable that not write any words in none-default language(and default language field has written)?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: TextTaable use HasFieldTextForLanguage if it is in other language,and the filed not wroten,it would get true

Post by Tony Li »

Hello,

TextTable.HasFieldTextForLanguage() will return false if the text table does not have a value for the language. However, if you're editing the text table in the Text Table editor window, it will set the field to a blank string, which is still a valid value. This isn't practical. Here's a patch which treats a blank string as not having text for the language:

PixelCrushers_TextTablePatch_2021-02-03.unitypackage


BTW, if the field is a blank string, TextTable.GetFieldTextForLanguage() always returns the default language's value. This way, if you haven't translated everything yet, you will still get some text at least.
Post Reply