Localizable.strings error - compiler says file is missing - objective-c

I tried adding a Localizable.strings file and add some strings to test with, everything works fine.
However, when I try to add a localization things starts to get weird. I am able to add a localization (english and russian) and I can see in finder that the files are listed in the two folders; ru.lproj and en.lproj.
When I clean and build I get the following compilation error:
Copy .strings file Error
The file "Localizable.strings" couldn't be opened because there is no such file.

Fixed it by a push in the right direction from this link provided by tiguero in the comment.
I looked further into the .pbxproj file and found this funky row, that looked fishy:
6AAE55EC1551A42500C1F3F0 /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = "<group>"; };
I removed it, cleaned and rebuild. It is now replaced by the following line:
6AC473DC1624BF3E00503305 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6AC473DE1624BF3E00503305 /* Localizable.strings */; };
And it works!

Related

Photoshop script suddenly stopped working - Error 8000

So I made a script for Photoshop based on this generator
The important part is
#target photoshop
function main() {
// prompt user to select source file, cancel returns null
var sourceFile = File.openDialog("Select a 1:1 sqaure PNG file that is at least 618x618.", "*.png", false);
if (sourceFile == null) {
// user canceled
return;
}
var doc = open(sourceFile, OpenDocumentType.PNG);
if (doc == null) {
alert("Oh shit!\nSomething is wrong with the file. Make sure it is a valid PNG file.");
return;
}
....
}
main();
this allways worked. But when today I wanted to change something in the script (I haven't even started yet and not used it for about 2 weeks) I suddendly only get an error (translated from german):
Error 8000: The file can not be opened since the parameters for opening are incorrect.
Line:764
-> doc = open(sourceFile, OpenDocumentType.PNG);
How can I open a PNG file via a File.Open dialog in a Photoshop script?
I already tried to add the app
var doc = app.open(sourceFile, OpenDocumentType.PNG);
to remove the document type specifier
var doc = open(sourceFile);
or to add this as I saw it in many forums
var doc = open(sourceFile, OpenDocumentType.PNG, undefined);
and variations between them. Nothing helped so far.
For debugging I also added
alert(sourceFile);
before the according line and get e.g.
~/Desktop/Example/originalImage_2000x2000.png
The problem apparently was with Photshop in general!
When I opened Photshop I didn't even get the default view of last opened files etc and actually was not able to open any file ... but never tested this first.
After rebooting the PC and launching Photshop now everything went back to normal and the script just runs fine and as expected.

How to convert Doc files to docx or pdf format using PHPWord?

I am trying to convert Doc(resumes) files to docx or pdf format using PHPWord.I downloaded PHPWord from github.
I tried Below code
require_once '../PHPWord.php';
$PHPWord = new PHPWord();
$document = $PHPWord->loadTemplate('Excel2003.doc');
// Save File
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('Excel2007.docx');
But getting error
Warning: include(/var/www/html/PHPWord-develop/src/PhpWord/PHPWord.php): failed to open stream: No such file or directory in /var/www/html/PHPWord-develop/readdoc.php on line 8
Warning: include(): Failed opening '/var/www/html/PHPWord-develop/src/PhpWord/PHPWord.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/PHPWord-develop/readdoc.php on line 8
Fatal error: Class 'PhpOffice\PHPWord' not found in /var/www/html/PHPWord-develop/readdoc.php on line 9
What is the solution?
Thanks in advance
After requiring the package and you are sure the current file can read the PhpOffice/PhpWord package then try and replace your code with this:
$PHPWord = new \PHPWord();
$document = $PHPWord->loadTemplate('Excel2003.doc');
// Save File
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('Excel2007.docx');
Then also note that if the doc you are trying to convert is of Word2007, then you can leave the second argument empty.

Too Many Directories when opening a CocosBuilder project

When I open a cocosbuilder project again after I adding some new directories, it pops up a dialog that says
Too Many Directories
You have created or opened a project which is in a directory with very many sub directories. Please save your project-files in a directory together with the resources you use in your project.
I know it is because there are too many directories.
But I wonder if there is any other method that can solves this problem except removing my new added directories.
Thanks.
You could always remove the warning directly in CocosBuilder source and rebuilt it, provided that you use the github version.
Otherwise you could petition for the change requested by MK on github.
The offending code is located in CocosBuilderAppDelegate.m, around line ~1155
[[CocosBuilderAppDelegate appDelegate] modalDialogTitle:#"Too Many [...]
You will have to remove this line in at least two places.
- (void) checkForTooManyDirectoriesInCurrentDoc
{
if (!currentDocument) return;
if ([ResourceManager sharedManager].tooManyDirectoriesAdded)
{
// Close document if it has too many sub directories
NSTabViewItem* item = [self tabViewItemFromDoc:currentDocument];
[tabView removeTabViewItem:item];
[ResourceManager sharedManager].tooManyDirectoriesAdded = NO;
// Notify the user
[[CocosBuilderAppDelegate appDelegate] modalDialogTitle:#"Too Many Directories" message:#"You have created or opened a file which is in a directory with very many sub directories. Please save your ccb-files in a directory together with the resources you use in your project."];
}
}
- (BOOL) checkForTooManyDirectoriesInCurrentProject
{
if (!projectSettings) return NO;
if ([ResourceManager sharedManager].tooManyDirectoriesAdded)
{
[self closeProject];
[ResourceManager sharedManager].tooManyDirectoriesAdded = NO;
// Notify the user
[[CocosBuilderAppDelegate appDelegate] modalDialogTitle:#"Too Many Directories" message:#"You have created or opened a project which is in a directory with very many sub directories. Please save your project-files in a directory together with the resources you use in your project."];
return NO;
}
return YES;
}
Update:
In CocosBuilder/ccBuilder/ResourceManager.h
There is a marco defined as below:
#define kCCBMaxTrackedDirectories 50
So we can simply change 50 to a larger number, and the problem can be solved.

iOS dev - referencing js files from settings root.plist

Inside my webviewcontroller.m file I reference external JS and CSS files to be used to manipulate the content I pull into the WebViewUI.
I can reference external files using;
[webView stringByEvaluatingJavaScriptFromString: #"var script = document.createElement('script');"
"script.type = 'text/javascript';"
"script.src = 'http://xxx/xxx.js';"
"document.getElementsByTagName('head')[0].appendChild(script);"];
But I keep having problems with referencing file paths using the settings root.plist;
NSString *JSStr = #"var script = document.createElement('script');"
"script.type = 'text/javascript';";
JSStr = [JSStr stringByAppendingString:[defaults stringForKey:#"overridejspath" ]];
JSStr = [ JSStr stringByAppendingString:#"document.getElementsByTagName('head')[0].appendChild(script);"];
[webView stringByEvaluatingJavaScriptFromString:JSStr];
I can successfully reference CSS files using a similar method, but not JS files. Can you help?

NSLocalizableString not found my key

I'm developing iPad international application.
I'm using methods NSLocalizableString to translate my application.
I have added keyword manually in my Localizable.strings in English and in French named "Orders" with value.
When I call my method NSLocalizableString with the keyword, it didn't found my keyword and don't apply the translation.
For keyword above and below, it's working perfectly.
Some code parts :
**Localizable.strings**
/* Change datas */
"ChangeDatas" = "Modifier les données";
/* Orders */
"Orders" = "Détails de votre commande";
/* Label */
"SomeLabel" = "Label";
**file.m**
//Work fine
NSLog(#"My data translation : %#", NSLocalizedString(#"ChangeDatas", #"Change datas"));
//Don't work
NSLog(#"My orders translation : %#", NSLocalizedString(#"Orders", #"Orders"));
Are you sure your editor was working in the right encoding? Also, with the correct line endings?
It can't hurt to check your .strings file with the plutil command.
Are you sure you've edited the .strings file for the same language/locale that you're using at runtime?