Bug 36029 - [Feature Request] Add support in mmp to recognize and correctly pull into bundle resource files
Summary: [Feature Request] Add support in mmp to recognize and correctly pull into bun...
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Other ()
Version: 2.4.0 (C6)
Hardware: Macintosh Mac OS
: Lowest enhancement
Target Milestone: master
Assignee: Bugzilla
Depends on:
Reported: 2015-11-18 20:24 UTC by Jon Goldberger [MSFT]
Modified: 2016-09-26 21:58 UTC (History)
3 users (show)

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 for Bug 36029 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Jon Goldberger [MSFT] 2015-11-18 20:24:43 UTC
Created attachment 13877 [details]
Test Project

## Description

A first note: the test project is a Classic API project, so this option is still available. I know that with a Unified API project, this option is removed, but this issue persists after updating to the Unified API regardless of the configuration used.

Without the "Include the Mono runtime in the application bundle" option selected (Debug configuration) the app builds and the app bundle includes the resx localization files and localization happens correctly. In Release configuration, with the "Include the Mono runtime in the application bundle" selected (or in Debug with that option selected) the app bundle does not include the resx localization files and localization does not occur in the app. 

## Steps to reproduce

1. Open the attached test project. 

2. Select the Release configuration and launch the app.

3. Click the "Print 'Abort' in French" or "Print 'Abort' in Chinese" button

Expected result: translated version of "Abort" will appear in text field above buttons.

Actual result: "Abort" appears in the text field no matter the language chosen.

## Notes

Run the app in Debug to see proper operation. Also update the project to the unified API and you will see that the translations never work regardless of configuration. 

Also note that I am unsure whether resx localization is supported by Xamarin.Mac. 

## Version info (mine)

=== Xamarin Studio ===

Version 5.10 (build 871)
Installation UUID: 964c531b-d928-456b-a9ae-e1f82266b360
	Mono 4.2.1 (explicit/6dd2d0d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010102

=== Xamarin.Profiler ===

Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 7.1.1 (9081)
Build 7B1005

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 3c0ec35
Branch: master
Build date: 2015-11-12 13:05:39-0500

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 510000871
Git revision: 4e9c5abb5ffdae12ba02ac49da83f8b2011dbb88
Build date: 2015-11-12 06:02:54-05
Xamarin addins: 55007ed0e56436f385d8e26394a45be563abc7e8
Build lane: monodevelop-lion-cycle6

=== Operating System ===

Mac OS X 10.11.1
Darwin Jons-iMac.local 15.0.0 Darwin Kernel Version 15.0.0
    Sat Sep 19 15:53:46 PDT 2015
    root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64
Comment 5 Chris Hamons 2015-11-19 10:15:28 UTC
The fr and zh-CHS folders aren't being copied into the app bundle. 

MMP doesn't have any specific knowledge of resource bundle format, so when you move to a bundle (via Unified or that checkbox in classic) the folders aren't being copied to the right location.

Teaching MMP to recognize and correctly handle resources would be a feature request, but there is a simple work around. Add two custom commands with the following command:

cp -r ${TargetDir}/fr ${TargetDir}/Localization.app/Contents/MonoBundle/
cp -r ${TargetDir}/zh-CHS ${TargetDir}/Localization.app/Contents/MonoBundle/

to your Localization project. 

That way, you'll copy the right bits in post bundle. 

If you turn on code signing, you'll need to add an additional custom command to resign, as adding/removing files will invalidate the signature.
Comment 6 Chris Hamons 2016-02-02 21:36:00 UTC
https://developer.xamarin.com/samples/mac/UseMSBuildToCopyFilesToBundleExample/ is the new better way to do this post-build copying.

We could add support for that resource format, possibly some custom build action, but it is likely very far off if at all on our radar, since it is easy for people to code their specific resource needs into the build now.