Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7826] iOS: Change the mail's dialogue language dynamically

GitHub Issuen/a
TypeBug
PriorityMedium
StatusReopened
ResolutionUnresolved
Affected Version/sRelease 1.8.1
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterShannon Hicks
AssigneeUnknown
Created2012-02-23T11:40:48.000+0000
Updated2018-03-06T18:57:59.000+0000

Description

Problem description

Currently, the i18n support allows the customer to change the language of the app when running, except for the mail dialogs, that stick to the default settings of CFBundleDevelopmentRegion in Info.plist.

Actual results

Even if you changed the phone's language to a new one, you will be seeing the default language from CFBundleDevelopmentRegion.

Expected Results.

When you change the language in the phone's settings, it should reflect in the mail dialog.

Steps to reproduce

1. Create a mobile App 2. Add the code 3. Change the phone's language in the main settings 4. Start the app and start the dialogue 4. You won't see the i18n change in the mail dialogue language.

var win = Ti.UI.createWindow();

// initialize to all modes
win.orientationModes = [
	Titanium.UI.PORTRAIT,
	Titanium.UI.LANDSCAPE_LEFT,
	Titanium.UI.LANDSCAPE_RIGHT
];


Titanium.Media.openPhotoGallery({
	allowEditing:true,

	success: function(event)
	{
		var emailDialog = Titanium.UI.createEmailDialog();
		if (!emailDialog.isSupported()) {
		Ti.UI.createAlertDialog({
			title:'Error',
			message:'Email not available'
		}).show();
		return;
		}
		emailDialog.setSubject('Hello from Titanium!');
		emailDialog.setToRecipients(['foo@yahoo.com']);
		emailDialog.setCcRecipients(['bar@yahoo.com']);
		emailDialog.setBccRecipients(['blah@yahoo.com']);
		
		if (Ti.Platform.name == 'iPhone OS') {
			emailDialog.setMessageBody('<b>Appcelerator Titanium Rocks!</b>å');
			emailDialog.setHtml(true);
			emailDialog.setBarColor('#336699');
		} else {
			emailDialog.setMessageBody('Appcelerator Titanium Rocks!');
		}

		// attach a blob
		emailDialog.addAttachment(event.media);
		
		// attach a file
		var f = Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'cricket.wav');
		emailDialog.addAttachment(f);
		
		emailDialog.addEventListener('complete',function(e)
		{
			if (e.result == emailDialog.SENT)
			{
				if (Ti.Platform.osname != 'android') {
					// android doesn't give us useful result codes.
					// it anyway shows a toast.
					alert("message was sent");
				}
			}
			else
			{
				alert("message was not sent. result = " + e.result);
			}
		});
		emailDialog.open();
	},

	error: function(error)
	{

	},

	cancel: function()
	{

	}
});

win.open();

Attachments

FileDateSize
iOS Simulator Screen Shot 17 sep. 2015 10.41.03.png2015-09-17T09:42:33.000+0000291627

Comments

  1. Blain Hamon 2012-02-27

    Short version: Apple didn't see the use case of changing a language mid-app. Longer version: Their intended use case was to have the user change it deep within settings, and within an app, this locale is read-only. Apple provides no localization controls over MFMailComposeViewController, the native class we wrapper. Suggestion: What we should document is Apple's behavior with localization. We've seen this also within a web view, video player, etc, anyplace where Apple provides text buttons for us. For consistency's sake, Apple will use the system's device localization *only* when the application has been localized for it. Otherwise it will, indeed, fall back to CFBundleDevelopmentRegion. So in this case, I would suggest using the traditional l18n techniques to localize the App display name, so that it would show up with a localized name in Springboard (home) as well as signalling to iOS to localize the mail dialog to the device localization. It won't be dynamic on-the-fly localization using your techniques, but it will be better than always reverting to DevelopmentRegion.
  2. Mauro Parra-Miranda 2012-02-29

    Hello, for the customer: here is the info about how to localize the app name: http://developer.appcelerator.com/blog/2012/02/internationalization-of-app-names.html The only localization here would be the app name, changing here the mail lang as well, in sync with the phone's locale. Best, Mauro
  3. Blain Hamon 2012-03-06

    Due to the confluence of Apple's design and what appears to be a fix on the customer's side, resolving ticket. Closest resolution match is 'invalid' since there is no code nor documentation changes to be made.
  4. Fokke Zandbergen 2015-09-17

    [~ingo] I'd like to reopen this. The problem is not just changing the language while the app is open. See: http://fokkezb.nl/2013/05/24/app-store-locality/ And attached image showing the same for permission dialogs.
  5. Raymond Verbruggen 2015-09-17

    Fokke, thank you for reopening this ticket. The screenshot you provide is exactly what happens. When opening a Ti.map instance, iOS asks for user permission to use the actual location. The "internationalized" strings are shown in the dialog below some english default message or so. Could somebody please provide a fix? This is an update of a production app. Thanks a lot! Raymond
  6. Fokke Zandbergen 2015-09-21

    [~ray@raymondverbruggen.nl] can you confirm what the system language of the iPhone you tested on is? Could you attach a screenshot of the language & regional settings screen?

JSON Source