UITableView localized index

Discussion in 'iOS Programming' started by SamiGh, Mar 10, 2010.

  1. SamiGh macrumors newbie

    Joined:
    Mar 10, 2010
    #1
    Hey,

    I have a problem with localizing the indexes that appear on the right of a UITableView. I need the letters of these indexes to appear according to the used language in the iPhone. After searching I found that i have to use the following NSArray:
    Code:
    [[UILocalizedIndexedCollation currentCollation] sectionIndexTitles];
    
    When I tested it, I found out that it always gives English characters no matter what the used language is. But in the Contacts application, Both English and the default language characters appear on the right of the table.

    I appreciate any help concerning this subject

    Best regards

    Sami
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    I assume you are localizing to specific languages. Why don't you add your list of letters to each localization?
     
  3. SamiGh thread starter macrumors newbie

    Joined:
    Mar 10, 2010
    #3
    Thanks for the reply,
    I don't think that will work with the application. I am localizing it into two languages, but the data that is viewed in the table might be in any language. In the case of a different language, i'll end up with all the entries under the hash sign section.
    Does the contacts application follow this method?
     
  4. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    I don't entirely understand the use of the hash sign in Contacts.

    Either you're getting the characters to display in the index from the language you're displaying or you're getting the characters from the data you're displaying, or both I suppose.
     
  5. SamiGh thread starter macrumors newbie

    Joined:
    Mar 10, 2010
    #5
    Since you cannot force the data to start with a letter rather than a number or a symbol, you have to use the hash sign. I agree with you that there is no point of using it in Contacts application but some people replace letters with symbols such as: $am, or numbers. :S

    Till now, I get the characters from the language I am displaying rather than the data because there might be some letters that are missing in the data. I do that using the currentCollation that I referred to it in my first post, but it always returns english alphabetic. I have no idea why.
    In case there is no straight forward solution to achieve that, I think I will stick with your first suggestion to add it to localization.

    Thanks a lot :D
     

Share This Page