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

  • Home
  • SEARCH
  • 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 4615344
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:49:36+00:00 2026-05-22T01:49:36+00:00

I am working on an iphone application and I am wondering what the correct

  • 0

I am working on an iphone application and I am wondering what the correct practice is for abstracting out strings. I am used to creating a file with constant strings and referencing them in my application (such as urls, port numbers or even button labels). I am wondering if this is considered good practice in Obj-C and if so what the best way to do it is? Should I make a class with the strings? Or use the “.strings” file?

p.s I may be localizing my application at a later time. I havent looked into how to do it, but I figure abstracting out my strings is a good idea while i’m developping.

Thank you!
MGA

  • 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-22T01:49:37+00:00Added an answer on May 22, 2026 at 1:49 am

    generally, you interface with NSBundle. You use a string to read a localized version of the string (which is loaded from a localized strings file).

    there are also some macros some people use to lighten the syntax, these are prefixed with NSLocalizedString. NSLocalizedString implementations use NSBundle.

    imo, you should use string constants to identify the localized string you read (like you should with dictionaries and object keys).

    you can declare your constants using this form (objc assumed):

    extern NSString* const MONAppString_Download;
    

    and define like so:

    NSString* const MONAppString_Download = @"Download";
    

    then access it using:

    NSString * tableName = nil; // << using the default
    NSString * localized =
      [[NSBundle mainBundle]
        localizedStringForKey:MONAppString_Download
         value:MONAppString_Download // << return the string using the default localization if not found
          table:tableName];
    

    sometimes it helps to create wrapper functions to reduce the noise, especially when you use them in many places:

    // @return what's set to the above variable named  'localized'.
    NSString * MONLocalized_Download();
    

    then you set up your strings files like a map, one for each localization you support.

    so, whenever you need to read a string which is visible to the user, you use the above form. also consider that there are other resources to localize (nibs, images, pdfs, etc.) which you may bundle with your app. much of the work here is also abstracted by NSBundle, of CFBundle, if you prefer.

    good luck

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

Sidebar

Related Questions

I am currently working in iPhone application in which I have used wikitude api.
I am working on creating an iphone application which logins to we website and
I'm working with a small startup with the goal of creating an iPhone application.
I am working on Iphone application and new to dev. I am sorry if
I'm working on iphone application which needs to run offline at an exhibition. It
I'm working on an iPhone application. I have an object of class Row that
I'm working on an iPhone application which will use long-polling to send event notifications
I am working on an iPhone application. When the application starts I authenticate, establish
I am working on iphone networking application.. I am using asihttp , a wrapper
i'm working on an iPhone application which retrieve sqlite database from server through json/rest

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.