janpio closed pull request #339: Localizing hardcoded messages
URL: https://github.com/apache/cordova-plugin-camera/pull/339
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/plugin.xml b/plugin.xml
index 34059d07..0bb584f8 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -100,6 +100,7 @@
             <clobbers target="CameraPopoverHandle" />
          </js-module>
 
+         <resource-file src="src/ios/Camera.strings" 
target="en.lproj/Camera.strings" />
          <header-file src="src/ios/UIImage+CropScaleOrientation.h" />
          <source-file src="src/ios/UIImage+CropScaleOrientation.m" />
          <header-file src="src/ios/CDVCamera.h" />
diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m
index c71de054..695b2b2f 100644
--- a/src/ios/CDVCamera.m
+++ b/src/ios/CDVCamera.m
@@ -166,7 +166,7 @@ - (void)takePicture:(CDVInvokedUrlCommand*)command
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wtautological-pointer-compare"
                 NSString* settingsButton = 
(&UIApplicationOpenSettingsURLString != NULL)
-                    ? NSLocalizedString(@"Settings", nil)
+                    ? NSLocalizedStringFromTable(@"camera.settings", 
@"Camera", nil)
                     : nil;
 #pragma clang diagnostic pop
 
@@ -174,9 +174,9 @@ - (void)takePicture:(CDVInvokedUrlCommand*)command
                 dispatch_async(dispatch_get_main_queue(), ^{
                     [[[UIAlertView alloc] initWithTitle:[[NSBundle mainBundle]
                                                          
objectForInfoDictionaryKey:@"CFBundleDisplayName"]
-                                                
message:NSLocalizedString(@"Access to the camera has been prohibited; please 
enable it in the Settings app to continue.", nil)
+                                                
message:NSLocalizedStringFromTable(@"camera.prohibited", @"Camera", nil)
                                                delegate:weakSelf
-                                      
cancelButtonTitle:NSLocalizedString(@"OK", nil)
+                                      
cancelButtonTitle:NSLocalizedStringFromTable(@"camera.ok", @"Camera", nil)
                                       otherButtonTitles:settingsButton, nil] 
show];
                 });
             }
diff --git a/src/ios/Camera.strings b/src/ios/Camera.strings
new file mode 100644
index 00000000..751e4920
--- /dev/null
+++ b/src/ios/Camera.strings
@@ -0,0 +1,3 @@
+"camera.prohibited" = "Access to the camera has been prohibited; please enable 
it in the Settings app to continue.";
+"camera.ok" = "OK";
+"camera.settings" = "Settings";


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to