• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Converting a .strings text file to a NSArray or NSDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting a .strings text file to a NSArray or NSDictionary


  • Subject: Re: Converting a .strings text file to a NSArray or NSDictionary
  • From: Dev WO <email@hidden>
  • Date: Wed, 27 Sep 2006 21:08:30 +0200

Hi Chuck:)

Check that the strings file has {...} around it like this:

{
	key1="value one";
	key2="value two";
}

Actually this is correct.
It seems I have to implement a complete parser for my .strings files. I'll most probably be using it quite often, so I'm ready to invest some time to do it.
I'll be using it for 3 type of thing:
-get a complete NSDictionary or NSArray from a .strings
-get a partial NSDictionary or NSArray from a .strings based on a qualifer like "key contains xxxxx" (easy if I can get a complete NSArray)
-create a reverse NSDictionary/Array from value to key (I know I'll have to ensure the uniqueness of the value on my own if I do that)


What would be the best way to approach this? and maybe some pointer for the following steps;)

Thanks:)




Chuck



Hi Xavier,

you could read the content of your InputStream into a String and then use NSPropertyListSerialization to parse that String into a dictionary:

NSDictionary dict = (NSDictionary) NSPropertyListSerialization.propertyListFromString(fileContent);


Jan

Am 26.09.2006 um 12:06 schrieb Dev WO:

Hi:)

I've got a resource in my Framework (text.strings), I know I can access a specific key using WOResourceManager.stringForKey, but I need to create an array of all the key in the file.

I first though I could go through an InputStream like
rm.inputStreamForResourceNamed ("text.strings", FrameworkName, null))


but I'm not sure what to do next...

I think I'm probably not going the easiest way. Maybe WOResourceManager already has a feature to get all the key-value in a NSArray or NSDictionary, but I can't find it.

Any pointer is greatly appreciated.

Thanks

Xavier_______________________________________________
WebObjects-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/webobjects-dev

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net


This email sent to email@hidden

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/ practical_webobjects







_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Converting a .strings text file to a NSArray or NSDictionary
      • From: Gavin Eadie <email@hidden>
    • Re: Converting a .strings text file to a NSArray or NSDictionary
      • From: Chuck Hill <email@hidden>
References: 
 >Converting a .strings text file to a NSArray or NSDictionary (From: Dev WO <email@hidden>)
 >Re: Converting a .strings text file to a NSArray or NSDictionary (From: Jan Grathwohl <email@hidden>)
 >Re: Converting a .strings text file to a NSArray or NSDictionary (From: Dev WO <email@hidden>)
 >Re: Converting a .strings text file to a NSArray or NSDictionary (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: constructing a url...
  • Next by Date: Re: Converting a .strings text file to a NSArray or NSDictionary
  • Previous by thread: Re: Converting a .strings text file to a NSArray or NSDictionary
  • Next by thread: Re: Converting a .strings text file to a NSArray or NSDictionary
  • Index(es):
    • Date
    • Thread