further renaming
This commit is contained in:
1 parent
9e41537554
commit
ee03f6b866
353 files changed
+14
-15
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// LocalizationHelper.h
|
||||
// VoidLink
|
||||
//
|
||||
// Created by True砖家 on 2024/6/30.
|
||||
// Copyright © 2024 True砖家 on Bilibili. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef LocalizationHelper_h
|
||||
#define LocalizationHelper_h
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface LocalizationHelper : NSObject
|
||||
|
||||
// Method to get localized string with format arguments
|
||||
+ (NSString *)localizedStringForKey:(NSString *)key, ... NS_FORMAT_FUNCTION(1,2);
|
||||
|
||||
@end
|
||||
|
||||
#endif /* LocalizationHelper_h */
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// LocalizationHelper.m
|
||||
// VoidLink
|
||||
//
|
||||
// Created by True砖家 on 2024/6/30.
|
||||
// Copyright © 2024 True砖家 on Bilibili. All rights reserved.
|
||||
//
|
||||
|
||||
#import "LocalizationHelper.h"
|
||||
|
||||
@implementation LocalizationHelper
|
||||
|
||||
+ (NSString *)localizedStringForKey:(NSString *)key, ... {
|
||||
va_list args;
|
||||
va_start(args, key);
|
||||
NSString *format = NSLocalizedStringFromTable(key, @"Localizable", nil);
|
||||
NSString *result = [[NSString alloc] initWithFormat:format arguments:args];
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// SwiftLocalizationHelper.swift
|
||||
// VoidLink
|
||||
//
|
||||
// Created by True砖家 on 2024/7/23.
|
||||
// Copyright © True砖家 on Bilibili. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class SwiftLocalizationHelper {
|
||||
|
||||
static func localizedString(forKey key: String, _ args: CVarArg...) -> String {
|
||||
let format = NSLocalizedString(key, tableName: "Localizable", bundle: .main, value: "", comment: "")
|
||||
return String(format: format, arguments: args)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user