National MessageBox title translation - winapi

I'm using the WinAPI MessageBox to show information to the users.
It uses the local translations for the buttons. Is there any way to get the local translations for "Information", "Error", "Confirmation" and "Question"?
Maybe any DLL, where I can get the resource string from... ?
Inside the user32.dll, I found "Yes", "No", "Ok", "Cancel" and more - but nothing for "Information", "Error", "Confirmation" and "Question".

User32 does contain the string for "Error" (resource id 2 on my machine), it is used when the title parameter is NULL.
Even if it did contain the other strings it would not be a good idea to use them because the resource identifiers are not documented and could change in the future.
Because you need to provide the translation for the main text you might as well just provide your own translations for the title as well...

Related

Hyperlinks in JSQMessagesViewController messages

I'm using the JSQMessages framework which is super awesome but I'm trying to enable hyperlinks in both the sent and received text messages - essentially i want to apply a find and replace system where certain words are replaced with pre determined hyperlinks, for example the word "stackoverflow" would turn into a hyperlink to stackoverflow when the user presses the send message button. The message receiver would then receive the hyperlink.
I have the find and replace system working fine however I'm struggling with the hyperlinks. As far as I can tell there doesn't seem to be any way to add hyperlinks to the messages as the "text" message element used to pass execute the message is an NSString and therefore cannot have a url attributed to it. However I hope I'm wrong, are hyperlinks, i.e. a word that links/executes a url when it's tapped, in text messages possible? If so what would be the recommended approach?
Thanks,
Matt
And for Swift 2.0 :
let attributes: [String:AnyObject] = [NSForegroundColorAttributeName:UIColor.redColor(), NSUnderlineStyleAttributeName: 1]
cell.textView!.linkTextAttributes = attributes
Please use following code in collectionView cellForItemAtIndexPath
Activate the data indicator as well..
cell.textView.dataDetectorTypes=UIDataDetectorTypeAll;
cell.textView.linkTextAttributes = #{ NSForegroundColorAttributeName : [UIColor jsq_messageBubbleBlueColor],
NSUnderlineStyleAttributeName : #(NSUnderlineStyleNone | NSUnderlineStyleNone) };

How do you format localized strings to have single words of a sentence be a link?

I am working on a globalized web-app in ASP.NET MVC3. The project contains the I18N resources files and I normally access the resources inside my Razor views like...
#I18N.MyResourceString
I have a tricky situation which I have not been able to figure out a elegant solution to yet. I need to be able to localized the sentence "Click here to donate." where the word 'here' should be a link to our donation system.
Most links in the site are internal so to create link I simply write...
#Html.ActionLink("Some link text", "MyAction", "MyController")
This donation link is external. What I have so far (which is not working) is...
#String.Format(I18N.ClickHereToDonate, "" + I18N.Here + "")
where the I18N.ClickHereToDonate resource's text is "Click {0} to donate.".
What I see on the screen is...
Click here to donate.
Furthermore, I would also like to add a 'title' attribute to the 'a' tag. It gets even uglier when I try that...
#String.Format(I18N.ClickHereToDonate, "" + I18N.Here + "")
There has to be a better way to form complex strings with embedded tags without concatenating things together in such a hackish manner. Not only does it not work (the intended markup got encoded) but it makes the HTML inside a string literal in my razor template which makes me loose any awesome IDE support/intergation/refactoring capabilities.
How can markup be injected into localized strings?
UPDATE
Adam Tuliper mentioned the #Html.Raw helper method in his answer so I added it to my already ugly markup...
#Html.Raw(String.Format(I18N.ClickHereToDonate, "" + I18N.Here + ""))
This at least got me a click-able link in the outputted markup.
Click here to donate.
It is still a far-less-than-elegant solution though so I am still looking for better ways of doing this.
Maybe try
#I18N.ClickHereToDonate
Overall, you don't need the String format - you can just inject the Razor things inside normal html elements.
Edit: Incorporating the below:
#Html.Raw(String.Format(#I18N.ClickHereToDonate,String.Format("<a href='http://paypal.com' title='{0}'>{1}</a>", I18N.PayPal,I18N.Here)))
Your choices are limited without built in support for this scenario (and there isn't in the helpers)
The cleaner way is to form your urls in a viewmodel and pass that view model to the view so you have minimal html. Your ViewModel contains
public class WhateverIndexViewModel
{
public string Key {get;set;}
public string URI {get;set;}
public string Title {get;set;}
}
Set the info in your controller, pass it to your view and use
#Links["YourKey"].Title"
As a basic idea.
Note if you dont want to use Html.Raw here then your URI in the class would be of type MvcString not String this way #Links["YourKey"].URI won't be html encoded.

Why are Facebook Likes insisting on using the wrong product image...?

My website, http://www.joaniesgifts.co.uk, includes the like button on the product pages. However, I've found that certain product pages are using the incorrect image when a user likes the page. This page is an example.
I think this may have been down to an original incorrect setup which is now corrected. However, the problem remains...
The only thing I have to go on is if I use the Facebook URL linter on the above product page I receive the following error.
Object at URL 'http://www.joaniesgifts.co.uk/terramundi-money-pot-holiday-fund' of type '213689662010141:product' is invalid because the domain 'www.joaniesgifts.co.uk' is not allowed for the application id '213689662010141' which owns the specified object type. If you are the owner of this application, you can verify your configured 'Site Domain' at developers.facebook.com/apps/213689662010141.
(I have verified my site's domain)
Everything else appears fine except it is also showing the wrong image! However, under Raw Open Graph Document Information it has the correct link!
If I then click Graph API - http://graph.facebook.com/10150450766583352 - it again shows the wrong image was linked!
What else could I do?
Also: The Graph API shows the incorrect image after a scrape only minutes ago.
{
"url": "http://www.joaniesgifts.co.uk/terramundi-money-pot-holiday-fund",
"type": "website",
"title": "Terramundi Money Pot - Holiday Fund",
"image": [
{
"url": "http://www.joaniesgifts.co.uk/index.php?route=product\u00252Fproduct\u00252Fcaptcha"
}
],
"updated_time": "2011-11-11T18:54:38+0000",
"id": "10150450766583352"
}
As this is an apparent bug in Facebook, I have gotten around this by removing the Open Graph type: product from the Facebook meta tags. At least the page works now and links the right images!

"You replied to this message on" title in add-in form region

Is there any way I can add the "You replied to this message on XXX" title (the current outlook one has a nice exclamation mark too!) easily to my own form region?
Perhaps define a placeholder in the form region and fill it somehow? I'm using C++.
Thanks,
Nili
Look in the XXXFactory class (XXX = your region name), in the FormRegionInitializing event handler. There you have access to e.OutlookItem which you could cast to a MailItem to get the date sent. Then set the mainifest's FormRegionName as you like.

How do I identify a dynamic-id custom-type text field in WATiR?

I have this input of type "Submit" that Watir cannot see. I can identify it by ID, but it doesn't turn up in browser.text_fields, or by any other idenfication method. The ID is dynamically generated so I cannot use it for testing. Any ideas on how to make this readable? I'm willing to change the WATiR source code if necessary.
<INPUT id=t8CPm value=Submit type=submit>
I have obviously tried text_field(:value, 'Submit') and text_field(:type, 'Submit'), and I get an "Unable to locate element" error.
Did you try treating it as a button element? Inputs of type submit are generally considered to be a button because the browser generally renders them that way.
try
browser.button(:value, 'Submit').flash
and see if it works for you
I changed INPUT_TYPES to ["text", "password", "textarea", "submit"] in the TextField class of input_elements.rb and there it was.
I should also probably edit the collections to read the type too.
Edit: I am an idiot and I didn't need to do this, but I'm leaving it here in case anyone else needs to identify a real dynamic-id custom-type text field, not a fake dynamic-id custom-type text field otherwise known in my particular case as a "button".

Resources