Code Monkey home page Code Monkey logo

Comments (88)

hsarret avatar hsarret commented on August 31, 2024

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.

gcerquant avatar gcerquant commented on August 31, 2024

If you want. Where to?

(but keep in mind that my test project is just a Xcode > New Project).

from lin.

hsarret avatar hsarret commented on August 31, 2024

Could you quit project, reload it and see if it works ?

from lin.

hsarret avatar hsarret commented on August 31, 2024

Screen Shot 2013-04-03 at 12 22 57
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.

gcerquant avatar gcerquant commented on August 31, 2024

Tried closing and restarting Xcode, or just closing re-opening the project, no changes.

from lin.

gcerquant avatar gcerquant commented on August 31, 2024

I also disabled all others Xcode plugins, and even with Lin project being the only one, it still does not work.

from lin.

gcerquant avatar gcerquant commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

Any .strings file should work.
In my exemple if added TOTO = "TITI"; to InfoPList.strings

from lin.

gcerquant avatar gcerquant commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

If there is no localized string the popup wont pop

from lin.

gcerquant avatar gcerquant commented on August 31, 2024

Yes, I did saved.

from lin.

gcerquant avatar gcerquant commented on August 31, 2024

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.

gcerquant avatar gcerquant commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

agreed, i'll look what i can do.

from lin.

gcerquant avatar gcerquant commented on August 31, 2024

What locale is your OS configured to? (me: english).

from lin.

hsarret avatar hsarret commented on August 31, 2024

i did look that conversation, i am sure we'll figure out problem soon.

from lin.

hsarret avatar hsarret commented on August 31, 2024

english also

from lin.

hsarret avatar hsarret commented on August 31, 2024

Did you checked if there is a Lin plugin in ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins ?

from lin.

hsarret avatar hsarret commented on August 31, 2024

Lunch time here, i'll get back to you after ;)

from lin.

hsarret avatar hsarret commented on August 31, 2024

Back

from lin.

gcerquant avatar gcerquant commented on August 31, 2024

Yes.
If not, Lin's menu would not appear in Edit menu of main menu bar.

from lin.

hsarret avatar hsarret commented on August 31, 2024

Indeed

from lin.

hsarret avatar hsarret commented on August 31, 2024

Confortable to try to debug plugin with me helping ?

from lin.

nek023 avatar nek023 commented on August 31, 2024

Thanks, hsarret.
I confirmed that Lin works correctly by using following steps.

  1. Download Lin-master from GitHub
  2. Open Lin.xcodeproj and build (⌘B)
  3. Relaunch Xcode
  4. Create a new iOS project
  5. Add localization: Japanese (for example)
  6. Add Localizable.strings and write some key-value pairs
  7. 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.

hsarret avatar hsarret commented on August 31, 2024

@gcerquant, i am still available to run you through a debugging session

from lin.

gcerquant avatar gcerquant commented on August 31, 2024

I'm traveling and won't be able to allocate time to it before a few weeks, sorry.

from lin.

ignazioc avatar ignazioc commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

I added a warning to specify that @ignazioc, pull requested @questbeat

from lin.

nek023 avatar nek023 commented on August 31, 2024

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.

olivierto avatar olivierto commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

Let me check that @olivierto, will let you know

from lin.

hsarret avatar hsarret commented on August 31, 2024

Just checked with latest and unmodified code (eaf394b) and it works with a Localizable.strings available both in english and french.

from lin.

olivierto avatar olivierto commented on August 31, 2024

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).

Capture d e cran 2013-04-19 a 14 40 31

from lin.

massimobio avatar massimobio commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

No specific location required.
For information, this is my Lin test project file.
Screen Shot 2013-04-19 at 15 06 28
I can see every strings for all 5 .strings file.

from lin.

olivierto avatar olivierto commented on August 31, 2024

@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.

hsarret avatar hsarret commented on August 31, 2024

@olivierto
/Users/hubertsarret/Downloads/Test/TestLin/TestLin/en.lproj/Localizable.strings
and
/Users/hubertsarret/Downloads/Test/TestLin/TestLin/fr.lproj/Localizable.strings

from lin.

olivierto avatar olivierto commented on August 31, 2024

damned can't understand why the hell lin isn't working... i'll try with a fresh new project.

from lin.

massimobio avatar massimobio commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

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.

massimobio avatar massimobio commented on August 31, 2024

Not open source sorry.

from lin.

olivierto avatar olivierto commented on August 31, 2024

No it isn't open source...
I'll give a try with a fresh new project.
I'll keep in touch

from lin.

hsarret avatar hsarret commented on August 31, 2024

@massimobio, @questbeat is the one who did the job ;)
I just added some features and helping him for support

from lin.

hsarret avatar hsarret commented on August 31, 2024

Who is up for a debugging session then ? ;) @massimobio ? @olivierto ?

from lin.

massimobio avatar massimobio commented on August 31, 2024

I see, thanks to @questbeat too then.
I'm available for debugging.

from lin.

hsarret avatar hsarret commented on August 31, 2024

ok @massimobio, know how to debug it ? or shall i explain how to configure ?

from lin.

massimobio avatar massimobio commented on August 31, 2024

Please explain :)

from lin.

hsarret avatar hsarret commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

Don't hesitate to ask questions, my explanation might be unclear ;)

from lin.

massimobio avatar massimobio commented on August 31, 2024

Got it to break

from lin.

hsarret avatar hsarret commented on August 31, 2024

Cool
line 410 is where we popup completion window
[self.popover showRelativeToRect:selectionRectInView ofView:textView preferredEdge:NSMinYEdge];

from lin.

massimobio avatar massimobio commented on August 31, 2024

localizationItems count is alway 0

from lin.

hsarret avatar hsarret commented on August 31, 2024

Basically, first we get selected line, we check it against our regular expressions, then we gather localizationItems

from lin.

hsarret avatar hsarret commented on August 31, 2024

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.

massimobio avatar massimobio commented on August 31, 2024

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.

massimobio avatar massimobio commented on August 31, 2024

Does that look right so far?

from lin.

hsarret avatar hsarret commented on August 31, 2024

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.

massimobio avatar massimobio commented on August 31, 2024

I have over 200 entries for all 8 languages.

from lin.

massimobio avatar massimobio commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

ok lets look deeper then, give me a sec to look where we should break next

from lin.

massimobio avatar massimobio commented on August 31, 2024

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.

massimobio avatar massimobio commented on August 31, 2024

I also have HockeySDK included and all the localizations look empty in self.localizations

from lin.

hsarret avatar hsarret commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

For it to trigger, you need to save any .strings file

from lin.

massimobio avatar massimobio commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

We should have that kind of lines there
Test = "Test";

from lin.

massimobio avatar massimobio commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

Here is content of english version of my InfoPlist.strings

/* Localized versions of Info.plist keys */

InfoPlist = "TITI";
InfoPlist2 = "TITI";

from lin.

massimobio avatar massimobio commented on August 31, 2024

Yep, UTF-16 vs UFT-8 on the newer project that works.

from lin.

hsarret avatar hsarret commented on August 31, 2024

We definitly need to pass a NSError instead of NULL there
and check results

from lin.

hsarret avatar hsarret commented on August 31, 2024

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.

massimobio avatar massimobio commented on August 31, 2024

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.

massimobio avatar massimobio commented on August 31, 2024

Thank you. Good team debugging :)

from lin.

hsarret avatar hsarret commented on August 31, 2024

I just did to get an easy repro case to work on fix :)

from lin.

hsarret avatar hsarret commented on August 31, 2024

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.

nek023 avatar nek023 commented on August 31, 2024

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.

massimobio avatar massimobio commented on August 31, 2024

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.

nek023 avatar nek023 commented on August 31, 2024

That's a good idea.

from lin.

hsarret avatar hsarret commented on August 31, 2024

For information @massimobio, i just sent to @questbeat a pull request which handle UTF16 .strings files.

from lin.

hsarret avatar hsarret commented on August 31, 2024

@gcerquant @massimobio @ignazioc @olivierto
Could you guys try with latest version and tell us if it is working now ?

from lin.

gcerquant avatar gcerquant commented on August 31, 2024

Works for me :)
Thank you.

from lin.

hsarret avatar hsarret commented on August 31, 2024

Glad to hear that @gcerquant

from lin.

olivierto avatar olivierto commented on August 31, 2024

Works for me too ! well done!

from lin.

massimobio avatar massimobio commented on August 31, 2024

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.

hsarret avatar hsarret commented on August 31, 2024

Could you please open a new issue with that @massimobio ?
Thanks

from lin.

massimobio avatar massimobio commented on August 31, 2024

sure

from lin.

hsarret avatar hsarret commented on August 31, 2024

Please close issue if everything is working for you @gcerquant

from lin.

Related Issues (20)

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.