• 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: WOResourceManager, opposite of stringForKey
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOResourceManager, opposite of stringForKey


  • Subject: Re: WOResourceManager, opposite of stringForKey
  • From: Dev WO <email@hidden>
  • Date: Wed, 5 Jul 2006 17:26:17 +0200

Hello Fabian,

Hi Xavier,

I have to had urls like:
French: http://www.domain.com/fr/une-page-en-français
English: http://www.domain.com/en/a-page-in-english
with a .strings file with:
aPage = "a-page-in-english"
localized in
aPage = "une-page-en-Français"

How about passing a unique identifier as an additional parameter? E.g.:


http://www.domain.com/fr/une-page-en-français_89
http://www.domain.com/en/a-page-in-english_89
This is a good idea, but my concern was really about typing as less code as possible, so as I will have some urls with more subdirectories (which will be variables in my application), I think I going to end up with at least as much code as just "get the string, iterate through the different key to check if their string is equal".
But maybe I'm wrong...

And, how about moving away from .strings files for this kind of thing and handle localization in the DB? If you ensure uniqueness of the localized key (which will be an issue in itself), you may then get away with using only the localized string for retrieval of the object.
That's true, but I was really considering both DB and .string files and I think .string will be better suited for this one as it will be mostly "static" pages, so easily maintainable.
In addition, if I go for DB I have to also write a management system, which will be used someday, but not really right now.
But I'll rethink about DB/.strings to make sure I'm doing the right choice.


I know I have to make sure strings are unique, but I think it's as much work to get a key from a string in either .string file or DB in my direct action code.

Thanks for your inputs Fabian,

Xavier


cheers

Fabian

And in my DA, I'd like to be able to directly get the key aPage from whatever localized string (either a-page-in-english or une- page-en-Français in this case).

I'm not even sure I made myself clear;)
so here's what I want to do:
-get each part of the url in a separate variable (for example, language and pagename)
-get the corresponding key for pagename
-passing the language to the pagename component


Basically that's what I'd like.

I'll try to rethink that a little bit...

Thanks,

Xavier



Why not reverse the problem and use an alias mapping.
it would look like this :
{
	// english alias
	search = "search";
	find = "search";
	// french alias
	recherche = "search";
	trouve = "search";
}
then in you DA, you would overwrite :
public WOActionResults performActionNamed(String anActionName)
to check the alias and finaly execute the right action.

- jfv

Le 06-07-04, à 15:55, Dev WO a écrit :

Hello Chuck,



On Jul 3, 2006, at 6:53 AM, Dev WO wrote:

Hi guys,
I'm probably missing something obvious, but I just don't see it...
Is there any simple way to get a key from a string? assuming the string will be localized using the .plist method.


No. And even if there was, the best you would get is a list of keys that match the string. Keys are unique, strings don't have to me.
That's right, huum I didn't though about this...


I know I can compare the string I get with the string for each language using stringForKey, but I though there's a convenient way to get the key directly.

Why are you passing localized values to a direct action? Would it not be better to pass the key in the URL rather than the localized version?
search engine:), the name in the URL is very powerful, so I have no choice but use it in the url.
I could use Apache rewrite to translate it to the correct key internally, but it would be more difficult to maintain on the development machine...



Chuck


I've been working on a new version of a website, with some parts that will be multilingual.
After reading about that, I decided to go the .strings way, with a localized .strings file (as the site isn't really dynamic).
It will be mostly DirectAction based.


So here's my question:
How can I access a key in my .strings file based on the value I got?
I mean, I know how to get the value from a key using WOResourceManager, but I'd like to ba able to request the opposite: the key based on (a localized) value.
That way I could make my DA more easier to maintain and a lot more smaller than explicitly write all the possible case in every language available.


I've red the WOResourceManager API, but without success.

Thanks for your help, have a nice sunday;)

Xavier

-- Coming sometime... - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/ wointro


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:
email@hidden


This email sent to email@hidden


__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com


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


This email sent to email@hidden

-- e-lumo oHG :: Prof.-Haindorf-Str. 25 :: 59063 Hamm

+49 2381 9722792  ::  Fax: +49 2381 9722793 :: AG Hamm HRA 1944





_______________________________________________ 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
References: 
 >Re: WOResourceManager, opposite of stringForKey (From: Dev WO <email@hidden>)
 >Re: WOResourceManager, opposite of stringForKey (From: Chuck Hill <email@hidden>)
 >Re: WOResourceManager, opposite of stringForKey (From: Dev WO <email@hidden>)
 >Re: WOResourceManager, opposite of stringForKey (From: Jean-François Veillette <email@hidden>)
 >Re: WOResourceManager, opposite of stringForKey (From: Dev WO <email@hidden>)
 >Re: WOResourceManager, opposite of stringForKey (From: Fabian Peters <email@hidden>)

  • Prev by Date: Re: WOResourceManager, opposite of stringForKey
  • Next by Date: WWDC WO Meet
  • Previous by thread: Re: WOResourceManager, opposite of stringForKey
  • Next by thread: Re: WOResourceManager, opposite of stringForKey
  • Index(es):
    • Date
    • Thread