Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localisation #659

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions ObjectiveGit/GTRepository+RemoteOperations.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ - (BOOL)fetchRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error
__block git_strarray refspecs;
int gitError = git_remote_get_fetch_refspecs(&refspecs, remote.git_remote);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to get fetch refspecs for remote"];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to get fetch refspecs for remote", @"")];
return NO;
}

Expand All @@ -104,7 +104,7 @@ - (BOOL)fetchRemote:(GTRemote *)remote withOptions:(NSDictionary *)options error

gitError = git_remote_fetch(remote.git_remote, &refspecs, &fetchOptions, reflog_message.UTF8String);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to fetch from remote"];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to fetch from remote", @"error")];
return NO;
}

Expand Down
44 changes: 22 additions & 22 deletions ObjectiveGit/GTRepository.m
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ + (instancetype)initializeEmptyRepositoryAtFileURL:(NSURL *)localFileURL options
git_repository *repository = NULL;
int gitError = git_repository_init_ext(&repository, path, &options);
if (gitError != GIT_OK || repository == NULL) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to initialize empty repository at URL %@.", localFileURL];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to initialize empty repository at URL %@.", @"error"), localFileURL];
return nil;
}

Expand Down Expand Up @@ -175,7 +175,7 @@ - (instancetype)initWithURL:(NSURL *)localFileURL error:(NSError **)error {
git_repository *r;
int gitError = git_repository_open(&r, localFileURL.path.fileSystemRepresentation);
if (gitError < GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to open repository at URL %@.", localFileURL];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to open repository at URL %@.", @"error"), localFileURL];
return nil;
}

Expand Down Expand Up @@ -206,7 +206,7 @@ - (instancetype)initWithURL:(NSURL *)localFileURL flags:(NSInteger)flags ceiling
git_repository *r;
int gitError = git_repository_open_ext(&r, localFileURL.path.fileSystemRepresentation, (unsigned int)flags, ceilingDirsString.fileSystemRepresentation);
if (gitError < GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to open repository at URL %@.", localFileURL];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to open repository at URL %@.", @"error"), localFileURL];
return nil;
}

Expand Down Expand Up @@ -291,7 +291,7 @@ + (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NS
if (serverCertificateURL) {
int gitError = git_libgit2_opts(GIT_OPT_SET_SSL_CERT_LOCATIONS, serverCertificateURL.fileSystemRepresentation, NULL);
if (gitError < GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to configure the server certificate at %@", serverCertificateURL];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to configure the server certificate at %@", @"error"), serverCertificateURL];
return nil;
}
}
Expand All @@ -307,7 +307,7 @@ + (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NS
git_repository *repository;
int gitError = git_clone(&repository, remoteURL, workingDirectoryPath, &cloneOptions);
if (gitError < GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to clone repository from %@ to %@", originURL, workdirURL];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to clone repository from %@ to %@", @"error"), originURL, workdirURL];
return nil;
}

Expand All @@ -322,7 +322,7 @@ - (id)lookUpObjectByGitOid:(const git_oid *)oid objectType:(GTObjectType)type er
if (error != NULL) {
char oid_str[GIT_OID_HEXSZ+1];
git_oid_tostr(oid_str, sizeof(oid_str), oid);
*error = [NSError git_errorFor:gitError description:@"Failed to lookup object" userInfo:@{GTGitErrorOID: [GTOID oidWithGitOid:oid]} failureReason:@"The object %s couldn't be found in the repository.", oid_str];
*error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to lookup object", @"error") userInfo:@{GTGitErrorOID: [GTOID oidWithGitOid:oid]} failureReason:@"The object %s couldn't be found in the repository.", oid_str];
}
return nil;
}
Expand Down Expand Up @@ -357,7 +357,7 @@ - (id)lookUpObjectByRevParse:(NSString *)spec error:(NSError **)error {
git_object *obj;
int gitError = git_revparse_single(&obj, self.git_repository, spec.UTF8String);
if (gitError < GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Revision specifier lookup failed." failureReason:@"The revision specifier \"%@\" couldn't be parsed.", spec];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Revision specifier lookup failed.", @"error") failureReason:@"The revision specifier \"%@\" couldn't be parsed.", spec];
return nil;
}
return [GTObject objectWithObj:obj inRepository:self];
Expand All @@ -370,7 +370,7 @@ - (GTBranch *)lookUpBranchWithName:(NSString *)branchName type:(GTBranchType)bra
int gitError = git_branch_lookup(&ref, self.git_repository, branchName.UTF8String, (git_branch_t)branchType);
if (gitError < GIT_OK && gitError != GIT_ENOTFOUND) {
if (success != NULL) *success = NO;
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Branch lookup failed"];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Branch lookup failed", @"error")];

return nil;
}
Expand All @@ -390,7 +390,7 @@ - (GTReference *)headReferenceWithError:(NSError **)error {
if (gitError == GIT_EUNBORNBRANCH) {
unborn = @" (unborn)";
}
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to get HEAD%@", unborn];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to get HEAD%@", @"error"), unborn];
return nil;
}

Expand All @@ -404,7 +404,7 @@ - (BOOL)enumerateBranchesWithType:(GTBranchType)type error:(NSError **)error usi
git_reference *gitRef = NULL;
int gitError = git_branch_iterator_new(&iter, self.git_repository, (git_branch_t)type);
if (gitError != GIT_OK) {
if (error) *error = [NSError git_errorFor:gitError description:@"Branch enumeration failed"];
if (error) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Branch enumeration failed", @"error")];
return NO;
}

Expand All @@ -418,7 +418,7 @@ - (BOOL)enumerateBranchesWithType:(GTBranchType)type error:(NSError **)error usi
}

if (gitError != GIT_OK && gitError != GIT_ITEROVER) {
if (error) *error = [NSError git_errorFor:gitError description:@"Branch enumeration failed"];
if (error) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Branch enumeration failed", @"error")];
return NO;
}

Expand Down Expand Up @@ -491,7 +491,7 @@ - (NSArray *)remoteNamesWithError:(NSError **)error {
git_strarray array;
int gitError = git_remote_list(&array, self.git_repository);
if (gitError < GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to list all remotes."];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to list all remotes.", @"error")];
return nil;
}

Expand All @@ -505,7 +505,7 @@ - (NSArray *)remoteNamesWithError:(NSError **)error {
- (BOOL)deleteRemoteNamed:(NSString *)remoteName error:(NSError **)error {
int gitError = git_remote_delete(self.git_repository, [remoteName cStringUsingEncoding:NSUTF8StringEncoding]);
if (gitError < GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to delete remote."];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to delete remote.", @"error")];
return NO;
}

Expand Down Expand Up @@ -538,7 +538,7 @@ - (BOOL)enumerateTags:(NSError **)error block:(GTRepositoryTagEnumerationBlock)b
};
int gitError = git_tag_foreach(self.git_repository, GTRepositoryForeachTagCallback, &payload);
if (gitError != GIT_OK && gitError != GIT_EUSER) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to enumerate tags"];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to enumerate tags", @"error")];
return NO;
}

Expand Down Expand Up @@ -567,7 +567,7 @@ - (GTReference *)createReferenceNamed:(NSString *)name fromOID:(GTOID *)targetOI
git_reference *ref;
int gitError = git_reference_create(&ref, self.git_repository, name.UTF8String, targetOID.git_oid, 0, message.UTF8String);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create direct reference to %@", targetOID];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to create direct reference to %@", @"error"), targetOID];
return nil;
}

Expand All @@ -582,7 +582,7 @@ - (GTReference *)createReferenceNamed:(NSString *)name fromReference:(GTReferenc
git_reference *ref;
int gitError = git_reference_symbolic_create(&ref, self.git_repository, name.UTF8String, targetRef.name.UTF8String, 0, message.UTF8String);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create symbolic reference to %@", targetRef];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to create symbolic reference to %@", @"error"), targetRef];
return nil;
}

Expand Down Expand Up @@ -621,7 +621,7 @@ - (NSArray *)referenceNamesWithError:(NSError **)error {
git_strarray array;
int gitError = git_reference_list(&array, self.git_repository);
if (gitError < GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to list all references."];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to list all references.", @"error")];
return nil;
}

Expand Down Expand Up @@ -667,7 +667,7 @@ - (NSString *)preparedMessageWithError:(NSError * __autoreleasing *)error {
}

if (error != NULL) {
*error = [NSError git_errorFor:errorCode description:@"Failed to read prepared message."];
*error = [NSError git_errorFor:errorCode description:NSLocalizedString(@"Failed to read prepared message.", @"error")];
}
};

Expand All @@ -693,7 +693,7 @@ - (GTCommit *)mergeBaseBetweenFirstOID:(GTOID *)firstOID secondOID:(GTOID *)seco
git_oid mergeBase;
int errorCode = git_merge_base(&mergeBase, self.git_repository, firstOID.git_oid, secondOID.git_oid);
if (errorCode < GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:errorCode description:@"Failed to find merge base between commits %@ and %@.", firstOID.SHA, secondOID.SHA];
if (error != NULL) *error = [NSError git_errorFor:errorCode description:NSLocalizedString(@"Failed to find merge base between commits %@ and %@.", @"error"), firstOID.SHA, secondOID.SHA];
return nil;
}

Expand All @@ -708,7 +708,7 @@ - (GTConfiguration *)configurationWithError:(NSError **)error {
git_config *config = NULL;
int gitError = git_repository_config(&config, self.git_repository);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to get config for repository."];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to get config for repository.", @"error")];
return nil;
}

Expand All @@ -719,7 +719,7 @@ - (GTIndex *)indexWithError:(NSError **)error {
git_index *index = NULL;
int gitError = git_repository_index(&index, self.git_repository);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to get index for repository."];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to get index for repository.", @"error")];
return nil;
}

Expand Down Expand Up @@ -766,7 +766,7 @@ - (GTSubmodule *)submoduleWithName:(NSString *)name error:(NSError **)error {
git_submodule *submodule;
int gitError = git_submodule_lookup(&submodule, self.git_repository, name.UTF8String);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to look up submodule %@.", name];
if (error != NULL) *error = [NSError git_errorFor:gitError description:NSLocalizedString(@"Failed to look up submodule %@.", @"error"), name];
return nil;
}

Expand Down
90 changes: 90 additions & 0 deletions ObjectiveGit/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/* No comment provided by engineer. */
"A filter named \"%@\" has already been registered" = "A filter named \"%@\" has already been registered";

/* error */
"Branch enumeration failed" = "Branch enumeration failed";

/* error */
"Branch lookup failed" = "Branch lookup failed";

/* No comment provided by engineer. */
"Could not create git index iterator." = "Could not create git index iterator.";

/* No comment provided by engineer. */
"Could not create status list." = "Could not create status list.";

/* No comment provided by engineer. */
"Could not iterate conflict." = "Could not iterate conflict.";

/* No comment provided by engineer. */
"Could not update index." = "Could not update index.";

/* error */
"Failed to clone repository from %@ to %@" = "Failed to clone repository from %1$@ to %2$@";

/* error */
"Failed to configure the server certificate at %@" = "Failed to configure the server certificate at %@";

/* error */
"Failed to create direct reference to %@" = "Failed to create direct reference to %@";

/* error */
"Failed to create symbolic reference to %@" = "Failed to create symbolic reference to %@";

/* error */
"Failed to delete remote." = "Failed to delete remote.";

/* error */
"Failed to enumerate tags" = "Failed to enumerate tags";

/* error */
"Failed to fetch from remote" = "Fetch von Remote ist fehlgeschlagen";

/* error */
"Failed to find merge base between commits %@ and %@." = "Failed to find merge base between commits %1$@ and %2$@.";

/* error */
"Failed to get config for repository." = "Failed to get config for repository.";

/* No comment provided by engineer. */
"Failed to get fetch refspecs for remote" = "Failed to get fetch refspecs for remote";

/* error */
"Failed to get HEAD%@" = "Failed to get HEAD%@";

/* error */
"Failed to get index for repository." = "Failed to get index for repository.";

/* error */
"Failed to initialize empty repository at URL %@." = "Failed to initialize empty repository at URL %@.";

/* error */
"Failed to list all references." = "Failed to list all references.";

/* error */
"Failed to list all remotes." = "Failed to list all remotes.";

/* error */
"Failed to look up submodule %@." = "Failed to look up submodule %@.";

/* error */
"Failed to lookup object" = "Failed to lookup object";

/* error */
"Failed to open repository at URL %@." = "Failed to open repository at URL %@.";

/* error */
"Failed to read prepared message." = "Failed to read prepared message.";

/* No comment provided by engineer. */
"Invalid file path URL to initialize repository." = "Invalid file path URL to initialize repository.";

/* No comment provided by engineer. */
"Invalid file path URL to open." = "Invalid file path URL to open.";

/* error */
"Revision specifier lookup failed." = "Revision specifier lookup failed.";

/* No comment provided by engineer. */
"Unregister the existing filter first." = "Unregister the existing filter first.";

2 changes: 2 additions & 0 deletions ObjectiveGit/en.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */