Page 1 of 1

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

Posted: Wed Feb 03, 2021 4:29 am
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)?

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

Posted: Wed Feb 03, 2021 9:56 am
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.