forked from mirrors/linphone-iphone
add localization framework
This commit is contained in:
parent
80dce63014
commit
f3ce8cfff3
5 changed files with 44 additions and 28 deletions
|
|
@ -47,7 +47,7 @@ extern void libmsamr_init();
|
|||
|
||||
-(void) onCall:(LinphoneCall*) currentCall StateChanged: (LinphoneCallState) new_state withMessage: (const char *) message {
|
||||
const char* lUserNameChars=linphone_address_get_username(linphone_call_get_remote_address(currentCall));
|
||||
NSString* lUserName = lUserNameChars?[[NSString alloc] initWithCString:lUserNameChars]:@"Unknown";
|
||||
NSString* lUserName = lUserNameChars?[[NSString alloc] initWithCString:lUserNameChars]:NSLocalizedString(@"Unknown",nil);
|
||||
const char* lDisplayNameChars = linphone_address_get_display_name(linphone_call_get_remote_address(currentCall));
|
||||
NSString* lDisplayName = lDisplayNameChars?[[NSString alloc] initWithCString:lDisplayNameChars]:@"";
|
||||
|
||||
|
|
@ -82,21 +82,21 @@ extern void libmsamr_init();
|
|||
//get default proxy
|
||||
linphone_core_get_default_proxy([LinphoneManager getLc],&proxyCfg);
|
||||
if (proxyCfg == nil) {
|
||||
lMessage=@"Please make sure your device is connected to the internet and double check your SIP account configuration in the settings.";
|
||||
lMessage=NSLocalizedString(@"Please make sure your device is connected to the internet and double check your SIP account configuration in the settings.",nil);
|
||||
} else {
|
||||
lMessage=[NSString stringWithFormat : @"Cannot call %@",lUserName];
|
||||
lMessage=[NSString stringWithFormat : NSLocalizedString(@"Cannot call %@",nil),lUserName];
|
||||
|
||||
}
|
||||
|
||||
if (message!=nil){
|
||||
lMessage=[NSString stringWithFormat : @"%@\nReason was: %s",lMessage, message];
|
||||
lMessage=[NSString stringWithFormat : NSLocalizedString(@"%@\nReason was: %s",nil),lMessage, message];
|
||||
}
|
||||
lTitle=@"Call failed";
|
||||
lTitle=NSLocalizedString(@"Call failed",nil);
|
||||
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:lTitle
|
||||
message:lMessage
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"Dismiss"
|
||||
cancelButtonTitle:NSLocalizedString(@"Dismiss",nil)
|
||||
otherButtonTitles:nil];
|
||||
[error show];
|
||||
[callDelegate displayDialerFromUI:mCurrentViewController
|
||||
|
|
@ -195,9 +195,9 @@ static void linphone_iphone_call_state(LinphoneCore *lc, LinphoneCall* call, Lin
|
|||
} else if (state == LinphoneRegistrationFailed ) {
|
||||
NSString* lErrorMessage=nil;
|
||||
if (linphone_proxy_config_get_error(cfg) == LinphoneReasonBadCredentials) {
|
||||
lErrorMessage = @"Bad credentials, check your account settings";
|
||||
lErrorMessage = NSLocalizedString(@"Bad credentials, check your account settings",nil);
|
||||
} else if (linphone_proxy_config_get_error(cfg) == LinphoneReasonNoResponse) {
|
||||
lErrorMessage = @"SIP server unreachable";
|
||||
lErrorMessage = NSLocalizedString(@"SIP server unreachable",nil);
|
||||
}
|
||||
[registrationDelegate displayRegistrationFailedFromUI:mCurrentViewController
|
||||
forUser:lUserName
|
||||
|
|
@ -210,10 +210,10 @@ static void linphone_iphone_call_state(LinphoneCore *lc, LinphoneCall* call, Lin
|
|||
&& linphone_proxy_config_get_error(cfg) != LinphoneReasonNoResponse) { //do not report network connection issue on registration
|
||||
//default behavior if no registration delegates
|
||||
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:@"Registration failure"
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Registration failure",nil)
|
||||
message:lErrorMessage
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"Continue"
|
||||
cancelButtonTitle:NSLocalizedString(@"Continue",nil)
|
||||
otherButtonTitles:nil ,nil];
|
||||
[error show];
|
||||
}
|
||||
|
|
@ -397,11 +397,11 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
|
||||
} else {
|
||||
if (configCheckDisable == false ) {
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:@"Warning"
|
||||
message:@"It seems you have not configured any proxy server from settings"
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Warning",nil)
|
||||
message:NSLocalizedString(@"It seems you have not configured any proxy server from settings",nil)
|
||||
delegate:self
|
||||
cancelButtonTitle:@"Continue"
|
||||
otherButtonTitles:@"Never remind",nil];
|
||||
cancelButtonTitle:NSLocalizedString(@"Continue",nil)
|
||||
otherButtonTitles:NSLocalizedString(@"Never remind",nil),nil];
|
||||
[error show];
|
||||
}
|
||||
}
|
||||
|
|
@ -617,10 +617,10 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
BOOL bAudioInputAvailable= [audioSession inputIsAvailable];
|
||||
|
||||
if(!bAudioInputAvailable){
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:@"No microphone"
|
||||
message:@"You need to plug a microphone to your device to use this application."
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"No microphone",nil)
|
||||
message:NSLocalizedString(@"You need to plug a microphone to your device to use this application.",nil)
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"Ok"
|
||||
cancelButtonTitle:NSLocalizedString(@"Ok",nil)
|
||||
otherButtonTitles:nil ,nil];
|
||||
[error show];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@
|
|||
@implementation UICallButton
|
||||
-(void) touchUp:(id) sender {
|
||||
if (!linphone_core_is_network_reachabled([LinphoneManager getLc])) {
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:@"Network Error"
|
||||
message:@"There is no network connection available, enable WIFI or WWAN prior to place a call"
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Network Error",nil)
|
||||
message:NSLocalizedString(@"There is no network connection available, enable WIFI or WWAN prior to place a call",nil)
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"Continue"
|
||||
cancelButtonTitle:NSLocalizedString(@"Continue",nil)
|
||||
otherButtonTitles:nil];
|
||||
[error show];
|
||||
return;
|
||||
|
|
@ -41,10 +41,10 @@
|
|||
if ([mAddress.text hasPrefix:@"sip:"]) {
|
||||
linphone_core_invite([LinphoneManager getLc], [mAddress.text cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
} else if ( proxyCfg==nil){
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:@"Invalid sip address"
|
||||
message:@"Either configure a SIP proxy server from settings prior to place a call or use a valid sip address (I.E sip:john@example.net)"
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid sip address",nil)
|
||||
message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to place a call or use a valid sip address (I.E sip:john@example.net)",nil)
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"Continue"
|
||||
cancelButtonTitle:NSLocalizedString(@"Continue",nil)
|
||||
otherButtonTitles:nil];
|
||||
[error show];
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@
|
|||
[self displayIncalViewforUser:username
|
||||
withDisplayName:displayName];
|
||||
[call setEnabled:false];
|
||||
[callDuration setText:@"Calling..."];
|
||||
[callDuration setText:NSLocalizedString(@"Calling...",nil)];
|
||||
[speaker reset];
|
||||
}
|
||||
|
||||
|
|
@ -244,17 +244,17 @@
|
|||
if (notif)
|
||||
{
|
||||
notif.repeatInterval = 0;
|
||||
notif.alertBody =[NSString stringWithFormat:@" %@ is calling you",username];
|
||||
notif.alertBody =[NSString stringWithFormat:NSLocalizedString(@" %@ is calling you",nil),username];
|
||||
notif.alertAction = @"Answer";
|
||||
notif.soundName = @"oldphone-mono-30s.caf";
|
||||
|
||||
[[UIApplication sharedApplication] presentLocalNotificationNow:notif];
|
||||
}
|
||||
} else {
|
||||
mIncomingCallActionSheet = [[UIActionSheet alloc] initWithTitle:[NSString stringWithFormat:@" %@ is calling you",username]
|
||||
mIncomingCallActionSheet = [[UIActionSheet alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@" %@ is calling you",nil),username]
|
||||
delegate:self
|
||||
cancelButtonTitle:@"Decline"
|
||||
destructiveButtonTitle:@"Answer"
|
||||
cancelButtonTitle:NSLocalizedString(@"Decline",nil)
|
||||
destructiveButtonTitle:NSLocalizedString(@"Answer",nil)
|
||||
otherButtonTitles:nil];
|
||||
mIncomingCallActionSheet.actionSheetStyle = UIActionSheetStyleDefault;
|
||||
[mIncomingCallActionSheet showInView:self.view];
|
||||
|
|
|
|||
BIN
Resources/en.lproj/Localizable.strings
Normal file
BIN
Resources/en.lproj/Localizable.strings
Normal file
Binary file not shown.
|
|
@ -19,6 +19,7 @@
|
|||
220FAD3810765B400068D98F /* libspeex.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 220FAD2F10765B400068D98F /* libspeex.a */; };
|
||||
220FAD3910765B400068D98F /* libspeexdsp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 220FAD3010765B400068D98F /* libspeexdsp.a */; };
|
||||
220FAE4B10767A6A0068D98F /* PhoneMainView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 220FAE4A10767A6A0068D98F /* PhoneMainView.xib */; };
|
||||
2214783D1386A2030020F8B8 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2214783B1386A2030020F8B8 /* Localizable.strings */; };
|
||||
2214EB7A12F846B1002A5394 /* UICallButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 2214EB7912F846B1002A5394 /* UICallButton.m */; };
|
||||
2214EB8912F84EBB002A5394 /* UIHangUpButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 2214EB8812F84EBB002A5394 /* UIHangUpButton.m */; };
|
||||
2214EBDA12F8558F002A5394 /* UIToggleButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 2214EBD912F8558F002A5394 /* UIToggleButton.m */; };
|
||||
|
|
@ -229,6 +230,7 @@
|
|||
220FAD2F10765B400068D98F /* libspeex.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libspeex.a; path = "liblinphone-sdk/apple-darwin/lib/libspeex.a"; sourceTree = "<group>"; };
|
||||
220FAD3010765B400068D98F /* libspeexdsp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libspeexdsp.a; path = "liblinphone-sdk/apple-darwin/lib/libspeexdsp.a"; sourceTree = "<group>"; };
|
||||
220FAE4A10767A6A0068D98F /* PhoneMainView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PhoneMainView.xib; sourceTree = "<group>"; };
|
||||
2214783C1386A2030020F8B8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Resources/en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
2214EB7812F846B1002A5394 /* UICallButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UICallButton.h; sourceTree = "<group>"; };
|
||||
2214EB7912F846B1002A5394 /* UICallButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UICallButton.m; sourceTree = "<group>"; };
|
||||
2214EB8712F84EBB002A5394 /* UIHangUpButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIHangUpButton.h; sourceTree = "<group>"; };
|
||||
|
|
@ -776,6 +778,7 @@
|
|||
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2214783B1386A2030020F8B8 /* Localizable.strings */,
|
||||
22A10D9E11F88C1F00373793 /* liblinphone.xcodeproj */,
|
||||
223148E51178A09900637D6A /* libmsilbc.a */,
|
||||
223148E31178A08200637D6A /* libilbc.a */,
|
||||
|
|
@ -899,6 +902,7 @@
|
|||
Japanese,
|
||||
French,
|
||||
German,
|
||||
en,
|
||||
);
|
||||
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
|
||||
projectDirPath = "";
|
||||
|
|
@ -960,6 +964,7 @@
|
|||
222A483412F7176F0075F07F /* IncallViewController.xib in Resources */,
|
||||
2218A92612FBE1340088A667 /* FirstLoginViewController.xib in Resources */,
|
||||
228B19AF130290C500F154D3 /* iTunesArtwork in Resources */,
|
||||
2214783D1386A2030020F8B8 /* Localizable.strings in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -994,6 +999,17 @@
|
|||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
2214783B1386A2030020F8B8 /* Localizable.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
2214783C1386A2030020F8B8 /* en */,
|
||||
);
|
||||
name = Localizable.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1D6058940D05DD3E006BFB54 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue