NS_WARNING("cannot get string from name\n");
NS_WARNING("cannot get string from name");
Localize(char *genericString, nsString &result) {    nsresult ret;        /* create a URL for the string resource file */    nsIIOService *pNetService = nsnull;    ret = nsServiceManager::GetService(kIOServiceCID, kIIOServiceIID,                                       (nsISupports**) &pNetService);    if (NS_FAILED(ret)) {        NS_WARNING("cannot get net service\n");        return ret;    }    nsIURI *uri = nsnull;    ret = pNetService->NewURI(PROPERTIES_URL, nsnull, &uri);    if (NS_FAILED(ret)) {        NS_WARNING("cannot create URI\n");        nsServiceManager::ReleaseService(kIOServiceCID, pNetService);        return ret;    }        nsIURI *url = nsnull;    ret = uri->QueryInterface(NS_GET_IID(nsIURI), (void**)&url);    nsServiceManager::ReleaseService(kIOServiceCID, pNetService);        if (NS_FAILED(ret)) {        NS_WARNING("cannot create URL\n");        return ret;    }        /* create a bundle for the localization */    nsIStringBundleService *pStringService = nsnull;    ret = nsServiceManager::GetService(kStringBundleServiceCID,        kIStringBundleServiceIID, (nsISupports**) &pStringService);    if (NS_FAILED(ret)) {        NS_WARNING("cannot get string service\n");        return ret;    }    char *spec = nsnull;    ret = url->GetSpec(&spec);    if (NS_FAILED(ret)) {        NS_WARNING("cannot get url spec\n");        nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService);        nsCRT::free(spec);        return ret;    }    nsILocale *locale = nsnull;    nsIStringBundle *bundle = nsnull;    ret = pStringService->CreateBundle(spec, locale, &bundle);    nsCRT::free(spec);    nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService);    if (NS_FAILED(ret)) {        NS_WARNING("cannot create instance\n");        return ret;    }        /* localize the given string */    nsAutoString strtmp;    strtmp.AssignWithConversion(genericString);    PRUnichar *ptrv = nsnull;    ret = bundle->GetStringFromName(strtmp.GetUnicode(), &ptrv);    NS_RELEASE(bundle);    if (NS_FAILED(ret)) {        NS_WARNING("cannot get string from name\n");    }    result = ptrv;    nsCRT::free(ptrv);    return ret;}