Change AssemblyName Based on Localized CFBundleDisplayName with Xamarin.Mac

berkbababerkbaba TRMember ✭✭
edited November 15 in Xamarin.Mac

Hi,

I coded a Xamarin.Mac app. I localized my app bundle name and bundle display name via InfoPlist.strings inside of "lproj" folders
with the help of xCode.

Localized bundle name is visible on menu via app name now:

However, unlike Xamarin.iOS, Xamarin.Mac gets app Dock name from Assembly Name in Project options, not from "CFBundleDisplayName" :

So, my app name on the dock icon could not response the localization settings, it stays unchanged.

So the important thing is:
How can I localize the "Assembly Name" in app options for Visual Studio Mac ? Thanks a lot.

Answers

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    You can not localize the assembly name, as that would require you to have different launchers for each langauge.

    If you have tokens in Info.plist file and in the InfoPlist.strings with CFBundleDisplayName, that should work. We aren't doing anything special inside Xamarin.Mac with application names. Consider filing an issue.

  • berkbababerkbaba TRMember ✭✭
    edited November 18

    Thanks ChrisHamons. I open an issue for that at here: https://github.com/xamarin/xamarin-macios/issues/7466

    I have tokens in Info.plist file and in the InfoPlist.strings with CFBundleDisplayName of course :smile:

    InfoPlist.strings

       /* 
          InfoPlist.strings
          AnkaraUniversity_Radio
    
          Created by Berk Babadoğan on 13.11.2019.
    
        */
    
        /* Localized Bundle Display Name */
        "CFBundleDisplayName" = "Ankara Üniversitesi Radyosu";
        "CFBundleName" = "Ankara Üniversitesi Radyosu";
    

    Info.plist

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>CFBundleDevelopmentRegion</key>
        <string>en_US</string>
        <key>CFBundleIdentifier</key>
        <string>com.bbsoft.AURadio</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <string>${PRODUCT_NAME}</string>
        <key>CFBundleDisplayName</key>
        <string>${PRODUCT_NAME}</string>
        <key>CFBundleExecutable</key>
        <string>${EXECUTABLE_NAME}</string>
        <key>LSHasLocalizedDisplayName</key>
        <true/>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleShortVersionString</key>
        <string>1.0</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>1</string>
        <key>LSApplicationCategoryType</key>
        <string>public.app-category.music</string>
        <key>LSMinimumSystemVersion</key>
        <string>10.15</string>
        <key>NSHumanReadableCopyright</key>
        <string>2019 Berk Babadoğan</string>
        <key>NSMainStoryboardFile</key>
        <string>Main</string>
        <key>NSPrincipalClass</key>
        <string>App</string>
        <key>XSAppIconAssets</key>
        <string>Assets.xcassets/AppIcon.appiconset</string>
        <key>AppleDockMenu</key>
        <string>DockMenu</string>
        <key>CFBundleLocalizations</key>
        <array>
            <string>en</string>
            <string>tr</string>
        </array>
    </dict>
    </plist>
    
Sign In or Register to comment.