Giter Site home page Giter Site logo

haoerloveyou / karenlocalizer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from akemin-dayo/karenlocalizer

0.0 2.0 0.0 3 KB

KarenLocalizer is a library that allows developers to add localization support to their iOS tweaks.

License: BSD 2-Clause "Simplified" License

Objective-C 58.95% Makefile 41.05%

karenlocalizer's Introduction

KarenLocalizer

KarenLocalizer is a library that allows developers to add localization support to their tweaks.

KarenLocalizer is BSD-licensed. See LICENSE for more information.

KarenLocalizer setup and usage (assuming you already have Theos)

  1. git clone https://github.com/angelXwind/KarenLocalizer.git

  2. cd KarenLocalizer/

  3. make install-to-theos

  4. In your project's Makefile, add karenlocalizer to your TweakName_LIBRARIES variable.

  5. In your project's control file, add net.angelxwind.karenlocalizer to the Depends: field.

When to use and when NOT to use KarenLocalizer

You can use KarenLocalizer to localize text inside your tweaks. For instance, any UIAlertViews your tweak shows, or text inside your tweak's UIViews, etc.

You should not use KarenLocalizer in things that already support localization (UIKit apps, etc.). While there isn't anything wrong with doing so, it's just unnecessary.

Example of KarenLocalizer usage

Tweak.xm
#import <KarenLocalizer/KarenLocalizer.h>
#import <UIKit/UIKit.h>
KarenLocalizer *karenLocalizer;
%ctor {
	karenLocalizer = [[KarenLocalizer alloc] initWithKarenLocalizerBundle:@"ExampleLocalizedTweak"];
}
%hook SpringBoard
-(void) applicationDidFinishLaunching:(id)arg {
	%orig(arg);
	UIAlertView *exampleAlert = [[UIAlertView alloc] initWithTitle:[karenLocalizer karenLocalizeString:@"LOCALIZED_TITLE"]
		message:[karenLocalizer karenLocalizeString:@"LOCALIZED_MESSAGE"]
		delegate:self
		cancelButtonTitle:[karenLocalizer karenLocalizeString:@"LOCALIZED_BUTTON"]
		otherButtonTitles:nil];
	[exampleAlert show];
}
%end

Localizable.strings

With the above example, you'd need to place Localizable.strings in layout/Library/KarenLocalizer/ExampleLocalizedTweak.bundle/Japanese.lproj/Localizable.strings

"LOCALIZED_TITLE" = "タイトル";
"LOCALIZED_MESSAGE" = "メッセージ";
"LOCALIZED_BUTTON" = "ボタン";

Note that KarenLocalizer will always look inside /Library/KarenLocalizer/ for bundles during initialisation.

karenlocalizer's People

Contributors

akemin-dayo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.