Comments (88)
Could you send us a small project of yours, so we can try to reproduce the issue ?
For information, i am using same Xcode version.
from lin.
If you want. Where to?
(but keep in mind that my test project is just a Xcode > New Project).
from lin.
Could you quit project, reload it and see if it works ?
from lin.
Working here with an up to date code base
Simple iOS project (Single View Application for iPad with "Use Automatic Reference Counting" on, "Use Storyboards" and Include Unit Tests" off)
from lin.
Tried closing and restarting Xcode, or just closing re-opening the project, no changes.
from lin.
I also disabled all others Xcode plugins, and even with Lin project being the only one, it still does not work.
from lin.
In your last screenshot, where does the value TOTO and TITI come from ? (I can't see a strings file other than the InfoPlist.strings in your project).
from lin.
Any .strings file should work.
In my exemple if added TOTO = "TITI"; to InfoPList.strings
from lin.
I have a similar line in my InfoPlist.strings :(
Do you have to do anything specific for the popup to come up (other than clicking on NSLocalizedString
code)?
Does the pop-up show up even if no localized strings are detected?
from lin.
Did you saved your InfoPList.strings file ?
As soon as your cursor is on a line containing either NSLocalizedString or localizedStringForKey:value:table: popup should ... pop ;)
from lin.
If there is no localized string the popup wont pop
from lin.
Yes, I did saved.
from lin.
It would be helpful for people discovering the plugin if a popup would show, stating: "No localized strings found".
It would also help a lot for troubleshooting.
from lin.
Please look at the twitter conversation mentioned in the ticket, I'm not the only one who could not use it. https://twitter.com/gcerquant/status/319362957853220864
from lin.
agreed, i'll look what i can do.
from lin.
What locale is your OS configured to? (me: english).
from lin.
i did look that conversation, i am sure we'll figure out problem soon.
from lin.
english also
from lin.
Did you checked if there is a Lin plugin in ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins ?
from lin.
Lunch time here, i'll get back to you after ;)
from lin.
Back
from lin.
Yes.
If not, Lin's menu would not appear in Edit menu of main menu bar.
from lin.
Indeed
from lin.
Confortable to try to debug plugin with me helping ?
from lin.
Thanks, hsarret.
I confirmed that Lin works correctly by using following steps.
- Download Lin-master from GitHub
- Open Lin.xcodeproj and build (⌘B)
- Relaunch Xcode
- Create a new iOS project
- Add localization: Japanese (for example)
- Add Localizable.strings and write some key-value pairs
- Write a
NSLocalizedString
So I think I need more information.
Could you try to close and reopen your project?
Now I'm checking older commits and found another bug of regular expression on fb7e583.
Maybe it is not related to this issue.
I will fix it later…
from lin.
@gcerquant, i am still available to run you through a debugging session
from lin.
I'm traveling and won't be able to allocate time to it before a few weeks, sorry.
from lin.
i had the same issues. i think it require a best explain: you need to have the string in the localized file in order to show this popup...if you have not a string the popup doesn't appear.
from lin.
I added a warning to specify that @ignazioc, pull requested @questbeat
from lin.
I think Lin doesn't work just after Xcode launched by opening your project.
Then close and reopen the project, and Lin works correctly.
I'll continue working on this issue. Sorry for inconvenience.
from lin.
I think the plugin isn't looking for Localizable.strings files in .lproj folder.
localized string in InfoPlists.strings ==> OK
localized string in .lproj folder (Localizable.strings) ==> KO
from lin.
Let me check that @olivierto, will let you know
from lin.
Just checked with latest and unmodified code (eaf394b) and it works with a Localizable.strings available both in english and french.
from lin.
Here is a screen shot on how my project looks like. The Localizable.strings is only in this folder (instead of storyboard, the link to this file is present in this folder + in controller file).
from lin.
Having similar issues. Lin works in one project but not in another. Does the Localizable.strings need to be in a specific location?
from lin.
No specific location required.
For information, this is my Lin test project file.
I can see every strings for all 5 .strings file.
from lin.
@hsarret can you tell me the full path to your localizable.strings?
here is mine /Users/olivierto/Documents/Iphone/MyApp/fr.lproj/Localizable.strings
from lin.
@olivierto
/Users/hubertsarret/Downloads/Test/TestLin/TestLin/en.lproj/Localizable.strings
and
/Users/hubertsarret/Downloads/Test/TestLin/TestLin/fr.lproj/Localizable.strings
from lin.
damned can't understand why the hell lin isn't working... i'll try with a fresh new project.
from lin.
btw @hsarret, thanks for making this awesome plugin!
Yeah, my Localizable.strings are in a similar place in my project. Works on one but not the other project.
If you need help with some debugging I'm available.
from lin.
Is your project open source ? I could debug it if you give me access
Or i can walk your around code for a debugging session
from lin.
Not open source sorry.
from lin.
No it isn't open source...
I'll give a try with a fresh new project.
I'll keep in touch
from lin.
@massimobio, @questbeat is the one who did the job ;)
I just added some features and helping him for support
from lin.
Who is up for a debugging session then ? ;) @massimobio ? @olivierto ?
from lin.
I see, thanks to @questbeat too then.
I'm available for debugging.
from lin.
ok @massimobio, know how to debug it ? or shall i explain how to configure ?
from lin.
Please explain :)
from lin.
You need to open Lin.xcodeproj
Open scheme, run section, choose Xcode.app as executable
Build and run
This will open a new instance of Xcode
Open your project with this new instance
Back to first Xcode and add a breakpoint in Lin.m line 358 (- (void)showPopoverWithTextView:(NSTextView *)textView)
Go back to second Xcode and select a line with NSLocalizedString or localizedStringForKey:value:table:
It should trigger breakpoint on your first Xcode
You should be able to step from there and see why popup is not showing
from lin.
Don't hesitate to ask questions, my explanation might be unclear ;)
from lin.
Got it to break
from lin.
Cool
line 410 is where we popup completion window
[self.popover showRelativeToRect:selectionRectInView ofView:textView preferredEdge:NSMinYEdge];
from lin.
localizationItems count is alway 0
from lin.
Basically, first we get selected line, we check it against our regular expressions, then we gather localizationItems
from lin.
ok let's step in line 403 then
In there self.localizations should contains entries of this kind
Printing description of self->_localizations:
{
"/Users/hubertsarret/Downloads/Test/TestLin/TestLin/Test.strings" = {
TestLin = {
"Test " = Test;
};
};
"/Users/hubertsarret/Downloads/Test/TestLin/TestLin/en.lproj/InfoPlist.strings" = {
en = {
"InfoPlist " = TITI;
"InfoPlist2 " = TITI;
};
};
"/Users/hubertsarret/Downloads/Test/TestLin/TestLin/en.lproj/Localizable.strings" = {
en = {
"Localizable " = awa;
};
};
"/Users/hubertsarret/Downloads/Test/TestLin/TestLin/fr.lproj/InfoPlist.strings" = {
fr = {
"InfoPlist " = TITI;
};
};
"/Users/hubertsarret/Downloads/Test/TestLin/TestLin/fr.lproj/Localizable.strings" = {
fr = {
"Localizable " = awa;
};
};
}
from lin.
This is a snippet from po self.localizations in Localizations.m break at 112
"/Users/momo/Desktop/iReal Pro iOS-OSX/Shared Resources/de.lproj/Localizable.strings" = {
de = {
};
};
"/Users/momo/Desktop/iReal Pro iOS-OSX/Shared Resources/en.lproj/Localizable.strings" = {
en = {
};
};
"/Users/momo/Desktop/iReal Pro iOS-OSX/Shared Resources/es.lproj/Localizable.strings" = {
es = {
};
};
"/Users/momo/Desktop/iReal Pro iOS-OSX/Shared Resources/fr.lproj/Localizable.strings" = {
fr = {
};
};
"/Users/momo/Desktop/iReal Pro iOS-OSX/Shared Resources/it.lproj/Localizable.strings" = {
it = {
};
};
"/Users/momo/Desktop/iReal Pro iOS-OSX/Shared Resources/ja.lproj/Localizable.strings" = {
ja = {
};
};
"/Users/momo/Desktop/iReal Pro iOS-OSX/Shared Resources/ko.lproj/Localizable.strings" = {
ko = {
};
};
from lin.
Does that look right so far?
from lin.
Your .strings files seems empty
Popup wont show if there is no string definitions in there
Could you add one string in any of your .strings file please ?
from lin.
I have over 200 entries for all 8 languages.
from lin.
Another snippet from above:
"/Applications/Mail.app/Contents/Resources/French.lproj/Info.strings" = {
French = {
};
};
"/Applications/Mail.app/Contents/Resources/French.lproj/InfoPlist.strings" = {
French = {
};
};
"/Applications/Mail.app/Contents/Resources/French.lproj/Localizable.strings" = {
French = {
};
};
"/Applications/Mail.app/Contents/Resources/French.lproj/LockStealing.strings" = {
French = {
};
};
"/Applications/Mail.app/Contents/Resources/French.lproj/MenuItems.strings" = {
French = {
};
};
"/Applications/Mail.app/Contents/Resources/French.lproj/Prefs.strings" = {
French = {
};
};
"/Applications/Mail.app/Contents/Resources/French.lproj/ReadOnlyError.strings" = {
French = {
};
};
"/Applications/Mail.app/Contents/Resources/French.lproj/ServicesMenu.strings" = {
French = {
};
};
from lin.
ok lets look deeper then, give me a sec to look where we should break next
from lin.
I have included a pointer to Mail.app use with ScriptingBridge...
ANyway, Lin doesn't seem to see it's localized string either (although it found the files...)
from lin.
I also have HockeySDK included and all the localizations look empty in self.localizations
from lin.
Ok let's break in Localization.m line 66
There we check content of .strings file against regular expressions.
Please check block local variable line
You should get to line 78 where we add pairs of key/value
from lin.
For it to trigger, you need to save any .strings file
from lin.
I put NSLog(@"line: %@", line); at line 65
2013-04-19 10:13:09.851 Xcode[24631:303] line: /* Localized versions of Info.plist keys /
2013-04-19 10:13:09.852 Xcode[24631:303] line:
2013-04-19 10:13:18.820 Xcode[24631:303] line: / Localized versions of Info.plist keys */
2013-04-19 10:13:18.821 Xcode[24631:303] line:
was all the output
from lin.
We should have that kind of lines there
Test = "Test";
from lin.
So, content is always null even though the filepath is correct. Could it be an encoding issue?
This is a very old project started in Xcode 3 so the encoding of the strings might be different. Let me check
from lin.
Here is content of english version of my InfoPlist.strings
/* Localized versions of Info.plist keys */
InfoPlist = "TITI";
InfoPlist2 = "TITI";
from lin.
Yep, UTF-16 vs UFT-8 on the newer project that works.
from lin.
We definitly need to pass a NSError instead of NULL there
and check results
from lin.
There it is...
Error Domain=NSCocoaErrorDomain Code=261 "The file “Test.strings” couldn’t be opened using text encoding Unicode (UTF-8)." UserInfo=0x4022a3260 {NSFilePath=/Users/hubertsarret/Downloads/Test/TestLin/TestLin/Test.strings, NSStringEncoding=4}
I'll look into it and submit a patch to @questbeat
Thanks for your time @massimobio
from lin.
I changed to NSUTF16StringEncoding in 225 Lin.m and now it loads all the localizations but my Xcode project doesn't open. It hangs al Loading...
You might be able to replicate all of this by changing the encoding in one of your localized files.
from lin.
Thank you. Good team debugging :)
from lin.
I just did to get an easy repro case to work on fix :)
from lin.
I just added an alert when using non UTF8 .strings file.
Hopefully it will help other users until we find a way to handle any kind of encoding.
from lin.
Thanks to @hsarret, @massimobio, @olivierto.
Lin uses NSUTF8StringEncoding from the first commit, but maybe it is necessary to recognize the encoding of the files (?)
from lin.
I don't know of a way to detect the encoding of a file.
I guess you could try NSUTF8StringEncoding and if it returns null try NSUTF16StringEncoding
from lin.
That's a good idea.
from lin.
For information @massimobio, i just sent to @questbeat a pull request which handle UTF16 .strings files.
from lin.
@gcerquant @massimobio @ignazioc @olivierto
Could you guys try with latest version and tell us if it is working now ?
from lin.
Works for me :)
Thank you.
from lin.
Glad to hear that @gcerquant
from lin.
Works for me too ! well done!
from lin.
Yes it works now although I had another issue.
I have included a pointer to Mail.app in my OS X project which is necessary if you use ScriptingBridge to open the Mail.app from within the app. The problem with this is that Lin parses Mail's localized files as well, and there are hundreds of them so it takes over 5 minutes for the project to open.
I added a simple if ([filePath hasPrefix:@"/Applications"]) return;
at line 47 in Localization.m but it feels a bit like a hack. There might be a better solution but I cannot think of it...
from lin.
Could you please open a new issue with that @massimobio ?
Thanks
from lin.
sure
from lin.
Please close issue if everything is working for you @gcerquant
from lin.
Related Issues (20)
- Lin is not case sensitive.
- Esc to dismiss Lin popover.
- Not all *.strings files are listed in Lin dialog. HOT 2
- Lin removes translation at index 0, not the selected one.
- crash on code completion HOT 2
- Table name HOT 10
- Doesn't work with Xcode Version 6.2 (6C131e) HOT 8
- How to custom auto complete key word ? HOT 3
- [New Feature] auto popup a new strings key panel if user enter a strings key that not exists. HOT 2
- [New Feature] Auto show strings values if the mouse is hovering in the strings key. HOT 1
- [New Feature] show alert message for non-exists strings keys HOT 1
- Autocompletion breaks after dot
- Doesn't work with Xcode Version 6.4 (6E35b) HOT 3
- The ability to replace the standard localization macro. HOT 2
- Xcode 7 Support HOT 2
- Custom function for autocompleting HOT 1
- XCode 7.1 Beta HOT 11
- doesn't work with xcode version 7.1.1 (7B1005) via Alcatraz HOT 1
- Not working for Xcode 7.2 (7C68) HOT 6
- Xcode8 Support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lin.