How do I make escapes in a .plist file? - ios

I need to set a Usage Description for my location manager in my apps info.plist. I wanted to force a newline with \n, but that just shows as "text text \n\n text text" in my app. Is it possible to force a new line in a plist string?

Use option + Enter (return) buttons to have new line while editing plist.

Related

Change text encoding to No Explicit in localizable file

Currently my text encoding of the Localizable.strings file is set to UTF-8. All my other localizable files are set to no explicit.
I want to change UTF-8 to No explicit, how is it possible ?
If you want to know, it's cause with xCode 10 this error appears
could not decode input file using specified encoding: Unicode (UTF-8), and the file contents appear to be encoded in Unicode (UTF-16)
You could try manually editing the project.pbxproj file to remove the fileEncoding = x for your Localizable.strings file?
To reset the Text-Encoding type. Select your language.string file:
Then select Text Encoding from right hand panel:
Update:
If you accidentally selected the Text-Encoding, then you have to reset it from project.pbxproj. To do this follow below steps:
Open package content of your Project.xcodeproj
Open project.pbxproj and search for your file-name and remove the fileEncoding = <encoding>; (for example: fileEncoding = 4;), and save the file.

NSLocalizedString always returns capitalized text

Ive run into an issue where NSLocalizedString is always returning strings capitalized regardless of its input. localization was working
and Im assuming I did something that caused this but I cannot seem
to figure out exactly what changed.
Here's my code:
func localize(_ str: String) -> String {
print("str in: \(str)")
return NSLocalizedString(str, comment: "")
}
I call it like this:
let txt = self.localize("Question")
print("txt = \(txt)")
Output:
str in: Question
txt = QUESTION
Things Ive tried:
Ive grep'd all of my .strings files and confirmed there is no
'QUESTION' in there.
Removed app from Simulator and re-run app
Changed incoming string to something that doesn't exist in any file such as 'randomxxyxxy'
Ive tried searching for quite a while on this issue and wasn't able to find anything that was like this problem.
Any help is appreciated,
Thank you
When your app is trying to localize a string but cannot find the translated text for it then it will show it in capitals. This is done to show you that the capitalized text is not localized. You can disable the capitalization of those cases by disabling the option: Show not-localized strings
This is how you do that:
Edit the scheme
Select the “Run” action and click the “Options” tab
Uncheck the “Show non-localized strings” option
In your case I think that your strings' localization is not working and so they are capitalized because that setting is activated.

spaces on mail body when we Open gmail app from iOS url schemes

Is it possible to provide spaces or new line or line breaks on gmail compose on URL schemes. I tried both /n or stringByAddingPercentEscapesUsingEncoding, but space or lines breaks are not reflecting.
googlegmail:///co?subject=subject&body= "\n\n\n textfirstname"
This is not an issue with iOS or url-scheme. You need to use html tag to set new line. For HTML there are <br/> or <br /> which are used to break line. Use this tag instead of \n.
As per you code it should looks like this:
Whatever<br/>text<br/>you<br/>want
I hope this will be useful to you.

How to custom alignment in Sublime Text 2?

Well I'm using Sublime Text 2 for a lot of tasks, included the creation of documents with LaTeX. I downloaded and installed the alignmentpackage and works great when I want to align respect the = symbol. But in LaTeX I need to align also with respect to & and sometimes % but I don't understand where or how can I custom that. I read the documentation about that package here, and now I see I must go to Preferences > Package Settings > Alignment > Settings – User but there the only I see is:
{
"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme",
"font_size": 12.0,
"ignored_packages":
[
"Vintage",
"PyV8"
]
}
And I don't know what exactly should I add, and if it's before close the {} o later opening a new pair. Could someone help me with that?
On my mac you would need to look at Alignment/Base File.sublime-settings
// The mid-line characters to align in a multi-line selection, changing
// this to an empty array will disable mid-line alignment
"alignment_chars": ["="],
Add the characters you want to align on either to this file, or create a user settings file as you indicated.
"alignment_chars": ["=", "%", "&"],
The contents of the file you listed is actually your user system preferences, not the user settings file for Alignment.

Localizable.strings is not working

I added a Localizable.strings to my project, but its not working... Here is a sample:
NSLog(#"Welcome Text: %#", NSLocalizedString(#"WelcomeKey", #""));
The Localizable.strings:
Localizable.strings // DE
"WelcomeKey" = "Willkommen!";
and
Localizable.strings // EN
"WelcomeKey" = "Welcome!";
The Localization native development region is en
The NSLog in console is:
2013-05-11 04:45:49.552 App[13752:907] Welcome Text: WelcomeKey
Any ideas what's wrong ?
The localization from the Storyboard is working.
Codierung of both files are UTF-16
Have you added a strings file to store the localized text. Click File > New > New File.
This link will be helpful to you. Please check this localizable strings.
I found this answer maybe helpful to you:
Select the localized storyboard eg. Chinese (Simplified)
In File Inspector, toggle from “Localizable Strings” to “Interface Builder Cocoa Touch Storyboard”. This will retain the strings you already had, so you don’t have to worry.
Now, change it back to “Localizable Strings”, and things should be updated!
Here to view original tutorial

Resources