mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-04-20 19:12:06 +00:00
More classes and methods for full translation
This commit is contained in:
parent
4108e725c8
commit
296112b04b
3 changed files with 91 additions and 41 deletions
106
Tweak.xm
106
Tweak.xm
|
|
@ -37,43 +37,26 @@ static inline NSString *LOC(NSString *key) {
|
|||
}
|
||||
}
|
||||
%end
|
||||
|
||||
// Replace (translate) old text to the new one
|
||||
%hook UILabel
|
||||
- (void)setText:(NSString *)text {
|
||||
NSBundle *tweakBundle = uYouLocalizationBundle();
|
||||
NSString *localizedText = [tweakBundle localizedStringForKey:text value:nil table:nil];
|
||||
NSArray *centered = @[@"SKIP", @"DISMISS", @"UPDATE NOW", @"DON'T SHOW"];
|
||||
|
||||
%orig;
|
||||
if (localizedText && ![localizedText isEqualToString:text]) {
|
||||
%orig(localizedText);
|
||||
self.adjustsFontSizeToFitWidth = YES;
|
||||
} else {
|
||||
%orig;
|
||||
}
|
||||
}
|
||||
%end
|
||||
|
||||
// Make non-attributed buttons text centered
|
||||
if ([centered containsObject:text]) {
|
||||
self.textAlignment = NSTextAlignmentCenter;
|
||||
self.adjustsFontSizeToFitWidth = YES;
|
||||
}
|
||||
|
||||
// Replace (translate) old text to the new one and extend its frame
|
||||
%hook UIButton
|
||||
- (void)setTitle:(NSString *)title forState:(UIControlState)state {
|
||||
NSBundle *tweakBundle = uYouLocalizationBundle();
|
||||
NSString *localizedText = [tweakBundle localizedStringForKey:title value:nil table:nil];
|
||||
NSString *newTitle = localizedText ?: title;
|
||||
|
||||
if (![newTitle isEqualToString:title]) {
|
||||
CGSize size = [newTitle sizeWithAttributes:@{NSFontAttributeName:self.titleLabel.font}];
|
||||
CGRect frame = self.frame;
|
||||
frame.size.width = size.width + 16.0;
|
||||
self.frame = frame;
|
||||
} %orig(newTitle, state);
|
||||
}
|
||||
%end
|
||||
|
||||
// Replace (translate) only a certain part of the text
|
||||
%group gAdditionalHook
|
||||
%hook UILabel
|
||||
- (void)setText:(NSString *)text {
|
||||
%orig;
|
||||
// Replace (translate) only a certain part of the text
|
||||
if ([text containsString:@"TOTAL ("]) {
|
||||
%orig([NSString stringWithFormat:@"%@ %@", LOC(@"TOTAL"), [text substringFromIndex:[text rangeOfString:@"("].location]]);
|
||||
}
|
||||
|
|
@ -107,9 +90,72 @@ static inline NSString *LOC(NSString *key) {
|
|||
}
|
||||
}
|
||||
%end
|
||||
|
||||
// Replace (translate) old text to the new one in Navbars
|
||||
%hook FRPreferences
|
||||
- (void)setTitle:(NSString *)title {
|
||||
NSBundle *tweakBundle = uYouLocalizationBundle();
|
||||
NSString *localizedText = [tweakBundle localizedStringForKey:title value:nil table:nil];
|
||||
|
||||
if (localizedText && ![localizedText isEqualToString:title]) {
|
||||
%orig(localizedText);
|
||||
} else {
|
||||
%orig(title);
|
||||
}
|
||||
}
|
||||
%end
|
||||
|
||||
%ctor {
|
||||
%init;
|
||||
%init(gAdditionalHook);
|
||||
}
|
||||
// WelcomeVC stuff
|
||||
%hook OBPrivacyLinkButton
|
||||
- (id)initWithCaption:(id)arg1 buttonText:(id)arg2 image:(id)arg3 imageSize:(CGSize)arg4 useLargeIcon:(BOOL)arg5 {
|
||||
return %orig(LOC(@"FollowMe"), arg2, arg3, arg4, arg5);
|
||||
}
|
||||
%end
|
||||
|
||||
// Reorder Tabs title
|
||||
%hook settingsReorderTable
|
||||
- (id)initWithTitle:(id)arg1 items:(id)arg2 defaultValues:(id)arg3 key:(id)arg4 header:(id)arg5 footer:(id)arg6 {
|
||||
return %orig(LOC(@"ReorderTabs"), arg2, arg3, arg4, arg5, arg6);
|
||||
}
|
||||
%end
|
||||
|
||||
// Translate Donation cell
|
||||
%hook UserButtonCell
|
||||
- (id)initWithLabel:(id)arg1 account:(id)arg2 imageName:(id)arg3 logo:(id)arg4 roll:(id)arg5 color:(id)arg6 bundlePath:(id)arg7 avatarBackground:(BOOL)arg8 {
|
||||
if ([arg2 containsString:@"developments by"]) {
|
||||
arg2 = [arg2 stringByReplacingOccurrencesOfString:@"developments by" withString:LOC(@"Developments")];
|
||||
} return %orig(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
|
||||
}
|
||||
%end
|
||||
|
||||
// Translate update messages
|
||||
%hook uYouCheckUpdate
|
||||
- (id)initWithTweakName:(id)arg1 tweakID:(id)arg2 version:(id)arg3 message:(id)arg4 tintColor:(id)arg5 showAllButtons:(BOOL)arg6 {
|
||||
if ([arg4 containsString:@"which it\'s the latest version."]) {
|
||||
NSString *version = arg3;
|
||||
arg4 = [NSString stringWithFormat:LOC(@"UpToDate"), version];
|
||||
}
|
||||
|
||||
else if ([arg4 containsString:@"is now available."]) {
|
||||
NSRange oldVerion = [arg4 rangeOfString:@" is now available."];
|
||||
NSString *version = [arg4 substringToIndex:oldVerion.location];
|
||||
arg4 = [NSString stringWithFormat:LOC(@"NewVersion"), version];
|
||||
} return %orig(arg1, arg2, arg3, arg4, arg5, arg6);
|
||||
}
|
||||
%end
|
||||
|
||||
// Replace (translate) old text to the new one and extend its frame
|
||||
%hook UIButton
|
||||
- (void)setTitle:(NSString *)title forState:(UIControlState)state {
|
||||
NSBundle *tweakBundle = uYouLocalizationBundle();
|
||||
NSString *localizedText = [tweakBundle localizedStringForKey:title value:nil table:nil];
|
||||
NSString *newTitle = localizedText ?: title;
|
||||
|
||||
if (![newTitle isEqualToString:title]) {
|
||||
CGSize size = [newTitle sizeWithAttributes:@{NSFontAttributeName:self.titleLabel.font}];
|
||||
CGRect frame = self.frame;
|
||||
frame.size.width = size.width + 16.0;
|
||||
self.frame = frame;
|
||||
} %orig(newTitle, state);
|
||||
}
|
||||
%end
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"Play your saved media in a custom player with background playback support and mini player." = "Play your saved media in a custom player with background playback support and mini player.";
|
||||
"More Options" = "More Options";
|
||||
"Play YouTube videos in the background and more, You can configure options from the settings." = "Play YouTube videos in the background and more. You can configure options from the settings.";
|
||||
"Follow me on Twitter" = "Follow me on Twitter";
|
||||
"FollowMe" = "Follow me on Twitter";
|
||||
"Continue" = "Continue";
|
||||
|
||||
/* uYou tab */
|
||||
|
|
@ -180,6 +180,7 @@
|
|||
"Hide Explore Tab" = "Hide Explore Tab";
|
||||
|
||||
"Reorder Tabs" = "Reorder Tabs";
|
||||
"ReorderTabs" = "Reorder Tabs";
|
||||
|
||||
"Other Settings" = "Other Settings";
|
||||
"Remove YouTube Ads" = "Remove YouTube Ads";
|
||||
|
|
@ -227,7 +228,8 @@
|
|||
"UYOU UPDATES" = "UYOU UPDATES";
|
||||
"Automatically Check For Updates" = "Automatically Check For Updates";
|
||||
"Check For Update" = "Check For Update";
|
||||
"You're using v.3.0 which is the latest version." = "You're using v.3.0 which is the latest version.";
|
||||
"UpToDate" = "You're using v.%@ which is the latest version.";
|
||||
"NewVersion" = "v.%@ is now available. Please make sure to always updating to the latest version to ensure having a flawless/uninterrupted experience.";
|
||||
|
||||
"SKIP" = "SKIP";
|
||||
"DON'T SHOW" = "DON'T SHOW";
|
||||
|
|
@ -237,7 +239,7 @@
|
|||
"SOCIAL MEDIA" = "SOCIAL MEDIA";
|
||||
"Developer" = "Developer";
|
||||
"Support my" = "Support my";
|
||||
" developments by" = "developments by";
|
||||
"Developments" = "developments by";
|
||||
"Donating" = "Donating";
|
||||
"You can support my iOS development by donating 🥰\n\n\"It’s not how much we give, but how much love we put into giving.\"\nMother Teresa" = "You can support my iOS development by donating 🥰\n\n\"It’s not how much we give, but how much love we put into giving.\"\nMother Teresa";
|
||||
"Designer" = "Designer";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"Play your saved media in a custom player with background playback support and mini player." = "Воспроизводите сохраненные медиафайлы в проигрывателе с поддержкой фонового воспроизведения и мини-плеером.";
|
||||
"More Options" = "Гибкие настройки";
|
||||
"Play YouTube videos in the background and more, You can configure options from the settings." = "Проигрывание видео в фоновом режиме и многое другое. Все параметры доступны в настройках.";
|
||||
"Follow me on Twitter" = "Подпишитесь на мой Твиттер";
|
||||
"FollowMe" = "Читайте меня в Twitter";
|
||||
"Continue" = "Продолжить";
|
||||
|
||||
/* uYou tab */
|
||||
|
|
@ -180,6 +180,7 @@
|
|||
"Hide Explore Tab" = "Скрыть Навигация";
|
||||
|
||||
"Reorder Tabs" = "Порядок вкладок";
|
||||
"ReorderTabs" = "Порядок вкладок";
|
||||
|
||||
"Other Settings" = "Другие настройки";
|
||||
"Remove YouTube Ads" = "Убрать рекламу";
|
||||
|
|
@ -227,17 +228,18 @@
|
|||
"UYOU UPDATES" = "ОБНОВЛЕНИЯ UYOU";
|
||||
"Automatically Check For Updates" = "Проверять обновления";
|
||||
"Check For Update" = "Проверить наличие обновлений";
|
||||
"You're using v.3.0 which it's the latest version." = "Данная версия является актуальной. Версия: 3.0";
|
||||
"UpToDate" = "Данная версия является актуальной. Версия: %@";
|
||||
"NewVersion" = "Доступна новая, %@ версия uYou. Не забывайте обновляться до последней версии для обеспечения плавного и бесперебойного опыта.";
|
||||
|
||||
"SKIP" = " ⨉";
|
||||
"DON'T SHOW" = " Скрыть";
|
||||
"DISMISS" = " Скрыть";
|
||||
"UPDATE NOW" = " Обновить";
|
||||
"SKIP" = "Позже";
|
||||
"DON'T SHOW" = "Скрыть";
|
||||
"DISMISS" = "Закрыть";
|
||||
"UPDATE NOW" = "Обновить";
|
||||
|
||||
"SOCIAL MEDIA" = "КОНТАКТЫ";
|
||||
"Developer" = "Разработчик";
|
||||
"Support my" = "Сделайте";
|
||||
" developments by" = "проект, сделав"; // Оставлю тут до лучших времен
|
||||
"Support my" = "Поддержите";
|
||||
"Developments" = "проект, сделав";
|
||||
"Donating" = "Пожертвование";
|
||||
"You can support my iOS development by donating 🥰\n\n\"It’s not how much we give, but how much love we put into giving.\"\nMother Teresa" = "Вы можете поддержать мои работы донатом 🥰\n\n«Дело не в том, сколько мы отдаем, а в том, сколько любви отдаем вместе с этим.»\nМать Тереза";
|
||||
"Designer" = "Дизайнер";
|
||||
|
|
|
|||
Loading…
Reference in a new issue