This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from xamarin/localization-sample
Create simple localization sample
- Loading branch information
Showing
34 changed files
with
2,115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2012 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XMLocalizationSample", "XMLocalizationSample\XMLocalizationSample.csproj", "{42AD1039-50A7-4920-A7AB-3AE735557E0B}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x86 = Debug|x86 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{42AD1039-50A7-4920-A7AB-3AE735557E0B}.Debug|x86.ActiveCfg = Debug|x86 | ||
{42AD1039-50A7-4920-A7AB-3AE735557E0B}.Debug|x86.Build.0 = Debug|x86 | ||
{42AD1039-50A7-4920-A7AB-3AE735557E0B}.Release|x86.ActiveCfg = Release|x86 | ||
{42AD1039-50A7-4920-A7AB-3AE735557E0B}.Release|x86.Build.0 = Release|x86 | ||
EndGlobalSection | ||
EndGlobal |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using AppKit; | ||
using Foundation; | ||
|
||
namespace XMLocalizationSample | ||
{ | ||
[Register ("AppDelegate")] | ||
public class AppDelegate : NSApplicationDelegate | ||
{ | ||
public AppDelegate () | ||
{ | ||
} | ||
|
||
public override void DidFinishLaunching (NSNotification notification) | ||
{ | ||
// Insert code here to initialize your application | ||
} | ||
|
||
public override void WillTerminate (NSNotification notification) | ||
{ | ||
// Insert code here to tear down your application | ||
} | ||
} | ||
} |
Binary file added
BIN
+7.93 KB
...nSample/XMLocalizationSample/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.3 KB
...mple/XMLocalizationSample/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+711 Bytes
...onSample/XMLocalizationSample/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.45 KB
...ample/XMLocalizationSample/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.3 KB
...nSample/XMLocalizationSample/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+57.9 KB
...mple/XMLocalizationSample/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.45 KB
...onSample/XMLocalizationSample/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.35 KB
...ample/XMLocalizationSample/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+57.9 KB
...nSample/XMLocalizationSample/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+173 KB
...mple/XMLocalizationSample/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions
68
XMLocalizationSample/XMLocalizationSample/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"images": [ | ||
{ | ||
"filename": "AppIcon-16.png", | ||
"size": "16x16", | ||
"scale": "1x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-16@2x.png", | ||
"size": "16x16", | ||
"scale": "2x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-32.png", | ||
"size": "32x32", | ||
"scale": "1x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-32@2x.png", | ||
"size": "32x32", | ||
"scale": "2x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-128.png", | ||
"size": "128x128", | ||
"scale": "1x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-128@2x.png", | ||
"size": "128x128", | ||
"scale": "2x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-256.png", | ||
"size": "256x256", | ||
"scale": "1x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-256@2x.png", | ||
"size": "256x256", | ||
"scale": "2x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-512.png", | ||
"size": "512x512", | ||
"scale": "1x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-512@2x.png", | ||
"size": "512x512", | ||
"scale": "2x", | ||
"idiom": "mac" | ||
} | ||
], | ||
"info": { | ||
"version": 1, | ||
"author": "xcode" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
XMLocalizationSample/XMLocalizationSample/Assets.xcassets/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
XMLocalizationSample/XMLocalizationSample/CustomBuildActions.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<CreateAppBundleDependsOn>$(CreateAppBundleDependsOn);WorkAroundLocalizationBug-ES;WorkAroundLocalizationBug-FR</CreateAppBundleDependsOn> | ||
</PropertyGroup> | ||
|
||
<Target Name="WorkAroundLocalizationBug-ES" Inputs="$(OutputPath)es/XMLocalizationSample.resources.dll" Outputs="$(AppBundleDir)/Contents/MonoBundle/es/XMLocalizationSample.resources.dll"> | ||
<Copy SourceFiles="$(OutputPath)es/XMLocalizationSample.resources.dll" DestinationFiles="$(AppBundleDir)/Contents/MonoBundle/es/XMLocalizationSample.resources.dll" /> | ||
</Target> | ||
<Target Name="WorkAroundLocalizationBug-FR" Inputs="$(OutputPath)fr/XMLocalizationSample.resources.dll" Outputs="$(AppBundleDir)/Contents/MonoBundle/fr/XMLocalizationSample.resources.dll"> | ||
<Copy SourceFiles="$(OutputPath)fr/XMLocalizationSample.resources.dll" DestinationFiles="$(AppBundleDir)/Contents/MonoBundle/fr/XMLocalizationSample.resources.dll" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?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> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?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>CFBundleName</key> | ||
<string>XMLocalizationSample</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.companyname.xmlocalizationsample</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>LSMinimumSystemVersion</key> | ||
<string>10.11</string> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>NSHumanReadableCopyright</key> | ||
<string></string> | ||
<key>NSPrincipalClass</key> | ||
<string>NSApplication</string> | ||
<key>NSMainStoryboardFile</key> | ||
<string>Main</string> | ||
<key>XSAppIconAssets</key> | ||
<string>Assets.xcassets/AppIcon.appiconset</string> | ||
|
||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using AppKit; | ||
|
||
namespace XMLocalizationSample | ||
{ | ||
static class MainClass | ||
{ | ||
static void Main (string[] args) | ||
{ | ||
NSApplication.Init (); | ||
NSApplication.Main (args); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
This sample shows two methods for localization your Xamarin.Mac application: | ||
|
||
- .resx files | ||
- Storyboard string files. | ||
|
||
Due to bug https://bugzilla.xamarin.com/show_bug.cgi?id=45696, where resx file localization is not being handled | ||
correctly during builds, custom MSBuild has been added to make things work. See CustomBuildActions.targets for details. | ||
|
||
To add storyboard localization in Xcode: | ||
- Open Main.storyboard in Xcode, select it in the Xcode project tree, then click "Localize" in the first tab of the | ||
right inspector. See 1.png | ||
- Then select the root project in the project tree, change the upper dropdown to point to the project. See 2.png | ||
- Then enable Base localization. See 3.png | ||
- Then add the specific languages in question. See 4.png | ||
- Close Xcode and delete Main.storyboard from your project, as it now is copied into specific Resources/ folder. |
68 changes: 68 additions & 0 deletions
68
XMLocalizationSample/XMLocalizationSample/Resources.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
XMLocalizationSample/XMLocalizationSample/Resources.es.resx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<root> | ||
<resheader name="resmimetype"> | ||
<value>text/microsoft-resx</value> | ||
</resheader> | ||
<resheader name="version"> | ||
<value>2.0</value> | ||
</resheader> | ||
<resheader name="reader"> | ||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
|
||
<data name="ButtonText"> | ||
<value>Button Text - Spanish</value> | ||
</data> | ||
|
||
<data name="LabelText"> | ||
<value>Label Text - Spanish</value> | ||
</data> | ||
|
||
</root> |
24 changes: 24 additions & 0 deletions
24
XMLocalizationSample/XMLocalizationSample/Resources.fr.resx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<root> | ||
<resheader name="resmimetype"> | ||
<value>text/microsoft-resx</value> | ||
</resheader> | ||
<resheader name="version"> | ||
<value>2.0</value> | ||
</resheader> | ||
<resheader name="reader"> | ||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
|
||
<data name="ButtonText"> | ||
<value>Button Text - French</value> | ||
</data> | ||
|
||
<data name="LabelText"> | ||
<value>Label Text - French</value> | ||
</data> | ||
|
||
</root> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<root> | ||
<resheader name="resmimetype"> | ||
<value>text/microsoft-resx</value> | ||
</resheader> | ||
<resheader name="version"> | ||
<value>2.0</value> | ||
</resheader> | ||
<resheader name="reader"> | ||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
|
||
<data name="ButtonText"> | ||
<value>Button Text - English</value> | ||
</data> | ||
|
||
<data name="LabelText"> | ||
<value>Label Text - English</value> | ||
</data> | ||
<data name="string1"> | ||
<value>hello</value> | ||
</data> | ||
</root> |
Oops, something went wrong.