iosMobileTable Search Translation

Is the “search” text in the table’s search field auto-translated and is there a way to override?
On a specific project I’m being told that search in Portuguese isn’t using the preferred term.

If it’s actually using Portuguese, it’d be the value that Apple supplies by default and they’d need to take that up with Apple. If (on the other hand) what it’s displaying is “Search” and the customer is mistaking it as Portuguese then it’s a localization issue that you can probably solve.

Add this method to TableSearchExtensionsXC in iOSDesignExtensions:

Public Sub SetSearchPlaceholderXC(extends table As iOSMobileTable, value As String)
  
  If ExtensionsXC.GetiOSVersionXC >= 13.0 then
    
    // Get the searchBar object
    Declare Function searchBar Lib "UIKit" selector "searchBar" (obj As ptr) As ptr
    Declare Function searchTextField Lib "UIKit" selector "searchTextField" (obj As ptr) As ptr
    
    Var searchPtr As ptr = table.SearchControllerHandle
    Var searchBarObj As ptr = searchBar(searchPtr)
    
    
    Declare sub setPlaceholder lib "UIKit" selector "setPlaceholder:" (obj as ptr, value as CFStringRef)
    
    setPlaceholder(searchBarObj, value)
    
  End If
End Sub

Then call it like this in the Table.Opening event

me.SetSearchPlaceholderXC("SOME OTHER PLACEHOLDER")

2 Likes

@Jeremie_L - You can remove a line from that method.

Declare Function searchTextField Lib "UIKit" selector "searchTextField" (obj As ptr) As ptr

it is not used.

2 Likes

Thanks guys!
I really appreciate this.