Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 760465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:43:17+00:00 2026-05-14T15:43:17+00:00

i need a multilingual coredata db in my iphone app. I could create different

  • 0

i need a multilingual coredata db in my iphone app. I could create different database for each language but i hope that in iphone sdk exist an automatically way to manage data in different language core data like for resources and string.

Someone have some hints?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:43:17+00:00Added an answer on May 14, 2026 at 3:43 pm

    I’ve done something similar to Shortseller, but without the use of categories.

    alt text

    InternationalBook and LocalizedBook are both custom managed objects with a one-to-many relationship (one international book to many localised books).

    In the implementation of InternationalBook, I’ve added a custom accessor for title:

    - (NSString *)title {
        [self willAccessValueForKey:@"title"];
        NSString *locTitle = nil;
        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"locale==%@", [DataManager localeString]];
        NSSet *localizedSet = [self.localizedBook filteredSetUsingPredicate:predicate];
        if ([localizedSet count] > 0) {
            locTitle = [[localizedSet valueForKey:@"localizedTitle"] anyObject];
        }
        [self didAccessValueForKey:@"title"];
        return locTitle;
    }
    

    [DataManager localeString] is a class method which returns the user’s language and country code: en_US, fr_FR, etc. See documentation on NSLocale for details.

    See the “Custom Attribute and To-One Relationship Accessor Methods” section of the Core Data Programming Guide for an explanation of willAccessValueForKey: and didAccessValueForKey:.

    When populating the data, I grab a string representing the user’s current locale ([DataManager localeString]), and store that along the with localised book title in a new LocalizedBook object. Each LocalizedBook instance is added to an NSMutableSet, which represents the one-to-many relationship.

    NSMutableSet *bookLocalizations = [internationalBook mutableSetValueForKey:@"localizedBook"]; // internationalBook is an instance of InternationalBook
    // set the values for locale and localizedTitle
    LocalizedBook *localizedBook = (LocalizedBook *)[NSEntityDescription insertnNewObjectEntityForName:@"LocalizedBook" inManagedObjectContext:self.bookMOC];
    localizedBook.locale = [DataManager localeString];
    localizedBook.localizedTitle = theLocalizedTitle; // assume theLocalizedTitle has been defined.
    [bookLocalizations addObject:localizedBook];
    [bookLocalizations setValue:localizedBook forKey:@"localizedBook"];
    

    Since the localised titles are being stored in the LocalizedBook managed object, you can make the title attribute a transient, but if you do that you can’t use title in a predicate.

    The nice thing about this approach is that the implementation of the to-many relationship is transparent to any consumers. You simply request internationalBook.title and the custom accessor returns the appropriate value based on the user’s locale behind the scenes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create interface MultiLingual, that allows to display object's data in different
I am creating a multilingual site that will need to support at minimum five
Need a function that takes a character as a parameter and returns true if
Need to an expression that returns only things with an I followed by either
need ask you about some help. I have web app running in Net 2.0.
Need a function like: function isGoogleURL(url) { ... } that returns true iff URL
I need to know about Epoll On linux System. Could you recommend manual or
I need to send hundreds of newsletters, but would like to check first if
I'm working on multilingual Asp.NET MVC application. In url i need to use category
Need a way to allow sorting except for last item with in a list.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.