Bug 8632 - Problem with Monotouch Storyboard localization (pre-localized files are not removed during sync-back)
Summary: Problem with Monotouch Storyboard localization (pre-localized files are not r...
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS add-in ()
Version: 3.0.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Jeffrey Stedfast
URL:
Depends on:
Blocks:
 
Reported: 2012-11-28 08:54 UTC by David Hoffmann
Modified: 2013-03-14 18:12 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description David Hoffmann 2012-11-28 08:54:28 UTC
Hi,

I have a problem with the localization of my storyboard.

My plan is to use a base localization (in a demo project) (you can see my screencast here: http://www.screencast.com/t/7tvnblgE  )

@ 1:49 I can see only one language (before restart there was base and english)

@ 2:15 why can I see two Storyboards? 
 - the original
 - the storyboard in the base folder

@ 2:39 where is my localization?
I can only see base..

@2:48 same problem

Where are my misunderstandig?
Can you help me?


Regards,
   David


MonoDevelop 3.0.5
Installation UUID: 3edb3c8b-1034-4172-8801-66a34af0f1c2
Runtime:
	Mono 2.10.9 (tarball)
	GTK 2.24.10
	GTK# (2.12.0.0)
	Package version: 210090011
Apple Developer Tools:
	 Xcode 4.5.2 (1847)
	 Build 4G2008a
Monotouch: 6.0.6
Mono for Android: 4.2.7
Android SDK: /Users/hoffmann/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		1.6   (API level 4)
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
Java SDK: /usr
Build information:
	Release ID: 30005000
	Git revision: e159cf083bd327933166819d94245298898d6e3d
	Build date: 2012-10-24 16:43:06+0000
	Xamarin addins: eea2ed91ae8dd242b281d5ec8f6c2fbc63b4cd3d
Operating System:
	Mac OS X 10.7.5
	Darwin SAMSTAG-IMAC 11.4.2 Darwin Kernel Version 11.4.2
	    Thu Aug 23 16:25:48 PDT 2012
	    root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
Comment 1 David Hoffmann 2012-11-28 10:18:14 UTC
I opend the storyboard with xcode. After that I make a copy of the generated code. In the copy I change the localization of the storyboard.

The diff shows this:

-------------------
$ diff ~/MYPROJ/obj/Xcode/18/ 18/
Only in 18/: .DS_Store
Common subdirectories: /Users/hoffmann/MYPROJ/obj/Xcode/18/Base.lproj and 18/Base.lproj
Common subdirectories: /Users/hoffmann/MYPROJ/obj/Xcode/18/DerivedData and 18/DerivedData
Only in 18/: Info.plist
Common subdirectories: /Users/hoffmann/MYPROJ/obj/Xcode/18/VerleihnixTouch.xcodeproj and 18/VerleihnixTouch.xcodeproj
Only in 18/: de.lproj
Only in 18/: en.lproj
-------------------

The problem is, that at the start of xcode the LOCALIZATION.lproj and the Info.plist files/directories are not copied.

I hope this helped.
Comment 2 Jeffrey Stedfast 2012-11-28 10:40:39 UTC
This has been fixed in MonoDevelop and should be included in a 3.0.7 release
Comment 3 Alan McGovern 2012-12-04 05:42:40 UTC
Jeff, We provided a wrench build of MonoDevelop/master to a customer and this issue is still affecting him. Can you double check that the required fixes were made in the master branch?
Comment 4 Jeffrey Stedfast 2012-12-04 10:51:49 UTC
There were 2 patches, and both are in master (I develop on master and then merge into the other branches):

82545621e47059f37b61c422cf0f308d0ddb30d3

and

a57157a2cf0f5afaa5555ad73aece5fa4b5d9ff2
Comment 5 Jeffrey Stedfast 2012-12-04 11:13:21 UTC
I think there might be some confusion...

When you click "Make Localized..." in Xcode, Xcode will move the storyboard (or xib) file into the *.lproj directories.

However, when MonoDevelop copies all of the files back, it *NEVER* deletes anything. That means, that when you sync back the *.storyboard files that you have localized, the original will still be in the non-lproj directory where it originally existed as well as existing in any *.lproj directories.

This means when you sync back out to Xcode, it will look like there is a duplicate storyboard (or xib) file.

It's less clear with storyboards than xibs, because at least xibs will put the language name in parens next to the xib filename, eg:

MyViewController.xib
MyViewController.xib
   MyViewController.xib (English)
   MyViewController.xib (German)


With storyboards, you just see:

MainStoryboard.storyboard
MainStoryboard.storyboard


Maybe we can re-think deleting xibs/storyboards when we sync back from Xcode, but that seems really risky.
Comment 6 Jeffrey Stedfast 2012-12-04 12:27:11 UTC
Ok, MonoDevelop removes the original storyboard from the project now (but does not delete the file on disk)
Comment 7 David Hoffmann 2012-12-05 03:17:58 UTC
Hi Jeffrey,

the problem is not only the double storyboard file.

The main problem is:
====================

In XCode I set the project to "Use Base Internationalization" and add some languages. In the dialog I set to
MainStoryboard_IPhone.storyboard     Base     Localizable Strings

At the project files I can unfold the MainStoryboard_IPhone.storyboad and see:
 - MainStoryboard_IPhone.storyboard (Base
 - MainStoryboard_IPhone.strings (German)
 - MainStoryboard_IPhone.strings (English)

After closing XCode the project will be synced with Monodevelop.

AND NOW THE PROBLEM
===================
If I reopen the Storyboard in XCode
 - in the project settings I am missing my languages (there is only "base")
 - I can't unfold the Storyboard to localize the strings.

Regards,
  David
Comment 8 Jeffrey Stedfast 2012-12-05 11:22:15 UTC
Okay, well, that works fine for me. I suspect that whatever MonoDevelop dmg that was given to you to try didn't include my fixes or something.

Basically, before my patches, only top-level *.lproj directories would be successfully exported to Xcode using the proper language codes.


In other words, if you had relative paths like these in your project:

Settings/SettingsViewController.cs
Settings/SettingsViewController.designer.cs
Settings/en.lproj/Settings.storyboard
Settings/de.lproj/Settings.storyboard


What would end up happening is that the Xcode project file would end up with language codes set to "Settings/en" and "Settings/de" because it would just chop off the ".lproj"

Try http://files.xamarin.com/~jeff/MonoDevelop-b5aecb4750aeb824a693214fec5b1b41a9097571.dmg
Comment 9 Jeffrey Stedfast 2012-12-05 12:40:51 UTC
I take it that this dmg has solved your issue?

You're welcome, btw. Your bug reports help us make our products better :-)
Comment 10 David Hoffmann 2012-12-05 12:50:53 UTC
Hi Jeff,

I test your dmg tomorrow in the office.
(I think that chris set to resolved). I'll send you a mail if it works.

Thank you very much for your help!

Regards,
  David
Comment 11 Jeffrey Stedfast 2012-12-05 12:52:27 UTC
No problem!
Comment 12 David Hoffmann 2012-12-06 02:02:58 UTC
Hi Jeff,

I am sorry but it doesn't work here :-(        (I used your .dmg)

I made a new screencast. http://screencast.com/t/DiOS7jifeFiM
Can you see where are my mistakes?

Regards,
  David
Comment 13 David Hoffmann 2012-12-06 02:08:40 UTC
From start to 2:10 min it works fine but the comes the problems.
Comment 14 Jeffrey Stedfast 2012-12-06 09:56:36 UTC
Ah, you are doing things differently than I was. The way I did it created a new storyboard file for each lang (the procedure starts out the same, but then I used the toolbar on the right-hand side to select which languages instead of using project options)

I'm guessing that the strings files aren't being properly synced out to Xcode (or else not being added to the Xcode project file with the correct metadata).
Comment 15 David Hoffmann 2012-12-06 12:14:28 UTC
The problem with language based storyboardfiles is: If I want to add a new label I hat to add the label in every storyboard. At the other way I can add a label in one file and I can localize it in the strings files.
Comment 16 Jeffrey Stedfast 2012-12-06 13:04:44 UTC
Yea, I just never knew how to create the .strings files before. I didn't know what that checkbox was under the list of languages did. I guess now I know :-)

Took me a while to get this working because we didn't have the code in place to generate Xcode project files that used .strings localization, but I think I've got it all working now...

Can you try http://files.xamarin.com/~jeff/MonoDevelop-c78b60ebe93551f2afc1295522ecda99fdc28623.dmg and see if that works for you?

Preliminary testing seems to work for me so far.
Comment 17 David Hoffmann 2012-12-06 13:48:27 UTC
Hi Jeff,

thank you for your quick response!

I test your version tomorrow morning (7h GMT+1).

Regards, David
Comment 18 David Hoffmann 2012-12-07 01:32:50 UTC
Hi Jeff!

IT WORKS!

Thank you for your support!

All the best,
  David
Comment 19 Jeffrey Stedfast 2012-12-07 13:21:08 UTC
Awesome! I'm glad that one is solved!
Comment 20 Jeffrey Stedfast 2013-03-14 15:30:37 UTC
I had to revert this patch for 4.0.3 because of this: http://forums.xamarin.com/discussion/2254/xamarin-studio-4-0-2-hides-all-ib-files#latest

I'll try to figure out what caused it and re-add this feature for a future version.

First I gotta figure out how to reproduce the bug described on the forums... :-\
Comment 21 Jeffrey Stedfast 2013-03-14 15:33:44 UTC
I should note that I didn't have to revert the *whole* patch, just the bit that removes the pre-localized files from the MonoDevelop project.
Comment 22 Jeffrey Stedfast 2013-03-14 18:12:22 UTC
ok, un-reverted the patch now since I can't reproduce. Might not even be this code that caused it in the first place...

4.0.3 should ship with this patch in place.