NSLocalizedString error - objective-c

I created 2 InfoPlist.strings, one in portuguese and the other in english.
i use my string in .strings file like this:
"BtnTitle" = "Title"; (English)
"BtnTitle" = "Título"; (Portuguese)
when i debug either in the simulator and in the device gives me only :
BtnTitle as the result of the NSLog :
NSLog(#"Titulo : %#", NSLocalizedString(#"BtnTitle", #""));
The Log dont give me the property of the object "Title" or "Título", but the object name "BtnTitle"

InfoPlist.strings is localization for Info.plist. UI strings should go in Localizable.strings.

Related

How can I call a command from an scriptable application using Scripting Bridge?

I'm developing an application which needs to work with the Apple version of MS-Word using Scripting Bridge . I need to call a command of MS-Word defined in its sdef file but I can't figure out how to do it.
The definition of the command in the sdef file
<command name="reset" code="sTXTmFBr" description="Removes paragraph formatting that differs from the underlying style. For example, if you manually right align a paragraph and the underlying style has a different alignment, the reset method changes the alignment to match the style formatting.">
<direct-parameter type="4046"/>
</command>
and its definition in the header file
#interface WordApplication : SBApplication
...
- (void) reset:(Word4046)x; // Removes paragraph formatting that differs from the underlying style. For example, if you manually right align a paragraph and the underlying style has a different alignment, the reset method changes the alignment to match the style formatting.
...
#end
The definition of the type of the direct-parameter in the sdef file:
<enumeration name="4046" code="4046">
<enumerator name="paragraph" code="cpar"/>
<enumerator name="paragraph format" code="w136"/>
</enumeration>
and its definition in the header file
enum Word4046 {
Word4046Paragraph = 'cpar',
Word4046ParagraphFormat = 'w136'
};
typedef enum Word4046 Word4046;
The definition of the class of the object I want to reset:
<class name="paragraph format" code="w136" description="Represents all the formatting for a paragraph." inherits="base object" plural="paragraph formats">
...
</class>
and its definition in the header file
// Represents all the formatting for a paragraph.
#interface WordParagraphFormat : WordBaseObject
...
#end
The only way my app compiles and doesn't crash is:
WordApplication *sbApplication; // SBObject which represents Word App
WordParagraphFormat *sbParagraph; // SBObject which represents a paragraph format
[sbApplication reset:Word4046ParagraphFormat]
but it obviously does nothing because I'm not specifying the object I want to reset but the type of that object.
How can I reset the sbParagraph object?
Thanks.

IBM Worklight 6.0 - WL.TabBar.addItem title parameter not working correctly with "null" as value

According to the documentation for WL.TabBar.addItem regarding the title parameter:
WL.TabBar.addItem(id, callback, title, options);
title Mandatory string. The title of the tab. If null is passed, no title is displayed.
However, if I pass the value null like this:
WL.TabBar.addItem("myId", function(){ ... }, null, { ... });
I get this error:
Invalid invocation of method WL.TabBar.addItem;
Invalid value 'null' (object), expected type 'string'.
And if I pass an empty string " ", I don't see the title but there's empty spacing at the bottom, below the icon.
Well, it's clearly a bug... :)
I have opened a defect. Thanks!
If what you want to do is to center-align the icon in the tab when there is no text involved, then adding the following to your Android environment's .css file will suffice:
.tabSpan {
background-position:center;
}
In addition, and if required, you can also play with the icon dimensions.

NSLocalizableString not found my key

I'm developing iPad international application.
I'm using methods NSLocalizableString to translate my application.
I have added keyword manually in my Localizable.strings in English and in French named "Orders" with value.
When I call my method NSLocalizableString with the keyword, it didn't found my keyword and don't apply the translation.
For keyword above and below, it's working perfectly.
Some code parts :
**Localizable.strings**
/* Change datas */
"ChangeDatas" = "Modifier les données";
/* Orders */
"Orders" = "Détails de votre commande";
/* Label */
"SomeLabel" = "Label";
**file.m**
//Work fine
NSLog(#"My data translation : %#", NSLocalizedString(#"ChangeDatas", #"Change datas"));
//Don't work
NSLog(#"My orders translation : %#", NSLocalizedString(#"Orders", #"Orders"));
Are you sure your editor was working in the right encoding? Also, with the correct line endings?
It can't hurt to check your .strings file with the plutil command.
Are you sure you've edited the .strings file for the same language/locale that you're using at runtime?

how to associate vibration with a button click

I have to following code
-(IBAction)doVibrate{
[self vibrate];
}
-(void)vibrate{
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
both doVibrate and vibrate are is same class .but when i am clicking the button associated to the doVibrate it device not vibrating .
I have imported the AudioToolbox/AudioToolbox.h and AVFoundation/AVFoundation.
Can some one tell me where i am wrong.
Thanks
IBActions are usually of the following form:
- (IBAction)vibrate:(id)sender;
Note that the following 3 methods are all different:
- (IBAction)vibrate:(id)sender;
- (IBAction)vibrate; // no sender argument
- (void)doVibrate;
Here is what I would do. In your .h file, define the following method:
- (IBAction)vibrate:(id)sender;
// - (IBAction)vibrate; comment out this method
In your .m file, do the following:
- (IBAction)vibrate:(id)sender {
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
Now, when you save your .h and .m files, and switch back to your nib/xib file in Interface Builder, it may show a yellow warning message that "'vibrate' is no longer defined in "your class name here'. That's okay, as the following should remove that error. Control-click (or right-click) on the button and drag to your controller class and choose "vibrate:" as the method name to call (note the colon, :, in the method name).

Flex: Embedding fonts at runtime only works locally?

I'm trying to change the text format in a TextField I get from a .swf. I'm embedding my font in a myFont.swf:
public class TemplateFont extends Sprite
{
[Embed(source='../fontFiles/geogrotesque/Geogrotesque-Regular.ttf', fontName='theFontName')]
public static var FONT_TEXT:Class;
}
Then I'm loading it where I need it and registering it:
var FontLibrary:Class = e.target.applicationDomain.getDefinition("TemplateFont") as Class;
Font.registerFont(FontLibrary.FONT_TEXT);
And then I'm trying to set the format to my Textfield:
txtTitle.embedFonts = true;
txtTitle.antiAliasType = AntiAliasType.ADVANCED;
var titleFormat:TextFormat = txtTitle.getTextFormat(); //TextFormat is set in swf, just wanna change font at runtime.
titleFormat.font = "theFontName;
txtTitle.htmlText = title; //coming from xml sorrunded with CDATA
txtTitle.defaultTextFormat = titleFormat;
txtTitle.setTextFormat(titleFormat);
This all works fine when I'm running it on my computer, but as soon as I place my files on a server nothing shows. When I'm tracing the htmlText for the TextField it looks fine, but no text is showing up. I'm also tracing the registered fonts to see that they are there, and they are.
Anybody knows?
Two things:
The EULA of this font don't allowed to upload the font to a server.
Have you a legal copy of Geogrotesque? We only sell Open Type format (OT), but not True Type (TTF).
If you have doubts about this, please contact with Emtype.