[vlc-commits] macosx: Simplify translation macros
David Fuhrmann
git at videolan.org
Thu Nov 23 20:04:10 CET 2017
vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Thu Nov 23 19:57:55 2017 +0100| [214cc7818f6b01120bf865cbe7c7641b3bf73be4] | committer: David Fuhrmann
macosx: Simplify translation macros
The previous method had lots of dead code, so simplify by using
a one-line macro.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=214cc7818f6b01120bf865cbe7c7641b3bf73be4
---
modules/gui/macosx/VLCStringUtility.h | 9 ++++++---
modules/gui/macosx/VLCStringUtility.m | 17 -----------------
2 files changed, 6 insertions(+), 20 deletions(-)
diff --git a/modules/gui/macosx/VLCStringUtility.h b/modules/gui/macosx/VLCStringUtility.h
index 76dec00663..e75666cc2c 100644
--- a/modules/gui/macosx/VLCStringUtility.h
+++ b/modules/gui/macosx/VLCStringUtility.h
@@ -25,13 +25,17 @@
*****************************************************************************/
#import <Cocoa/Cocoa.h>
+
+#import <vlc_common.h>
#import <vlc_input.h>
-#define _NS(s) [[VLCStringUtility sharedInstance] localizedString: s]
+
+#define _NS(s) ((s) ? toNSStr(vlc_gettext(s)) : @"")
+
/* Get an alternate version of the string.
* This string is stored as '1:string' but when displayed it only displays
* the translated string. the translation should be '1:translatedstring' though */
-#define _ANS(s) [[[VLCStringUtility sharedInstance] localizedString: _(s)] substringFromIndex:2]
+#define _ANS(s) [((s) ? toNSStr(vlc_gettext(s)) : @"") substringFromIndex:2]
#define B64DecNSStr(s) [[VLCStringUtility sharedInstance] b64Decode: s]
#define B64EncAndFree(s) [[VLCStringUtility sharedInstance] b64EncodeAndFree: s]
@@ -58,7 +62,6 @@ NSImage *imageFromRes(NSString *o_id);
+ (VLCStringUtility *)sharedInstance;
-- (NSString *)localizedString:(const char *)psz NS_FORMAT_ARGUMENT(1);
- (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
- (NSString *)getCurrentTimeAsString:(input_thread_t *)p_input negative:(BOOL)b_negative;
- (NSString *)stringForTime:(long long int)time;
diff --git a/modules/gui/macosx/VLCStringUtility.m b/modules/gui/macosx/VLCStringUtility.m
index 742e045ba6..4487187659 100644
--- a/modules/gui/macosx/VLCStringUtility.m
+++ b/modules/gui/macosx/VLCStringUtility.m
@@ -64,23 +64,6 @@ NSString *const kVLCMediaUnknown = @"Unknown";
#pragma mark -
#pragma mark String utility
-- (NSString *)localizedString:(const char *)psz
-{
- NSString * stringObject = nil;
-
- if (psz != NULL) {
- stringObject = toNSStr(_(psz));
-
- if (stringObject == NULL) {
- msg_Err(getIntf(), "could not translate: %s", psz);
- return @"";
- }
- } else
- return @"";
-
- return stringObject;
-}
-
/* i_width is in pixels */
- (NSString *)wrapString:(NSString *)o_in_string toWidth:(int)i_width
{
More information about the vlc-commits
mailing list