I have an image with the word 'NEW' that should be localized to 'Nuevo', 'Nuovo', etc... based on locale. I am trying to find a way to localize this 'New' image in UIApplicationShortcutItemIconFile in the info.plist file.
So what I have done is that I added a line in each infoPlist.strings for English:
"NEW" = "New";
And Spanish:
"NEW" = "Nuevo";
And Italian:
"NEW" = "Nuovo";
where New, Nuevo and Nuovo are the names of the image files in images.xcassets. And in info.plist I have set the key UIApplicationShortcutItemIconFile to "NEW"
But that doesn't work and I don't get an icon at all before the quick action title. Instead a big black dot.
It's also important to mention that localizing UIApplicationShortcutItemTitle works without a problem using same above technique!
Is there any other way to try localizing this icon?
Related
I have localization in my app for French language which I have implemented like so...
I have a file called Localizable.strings(French) which contains all the French keywords given like so...
"Hello" = "Bonjour";
"Tree" = "Arbre";
"Sun" = "soleil";
And if I want to localize a particular label, I do it like so...
myLabel.text = "Hello".localized
Now say I get some keywords like these from an API :
"Moon" = "Lune”;
"car" = "auto”;
How can I update my Localizable.strings(French) file with these keywords programatically without having to go and manually enter the keywords I get from the API..?
I referred this link and also looked up other similar answers in SO..but couldn't get a solution yet...
With the iPhone 6s, Apple has introduced a new feature called "3D Touch". App developers are able to use this technology by using it within their apps or provide so-called UIApplicationShortcutItems on the home screen which appear when you 3D Touch the corresponding app icon. I've seen quite a few people out there who wanted to know how you would be able to localize those. Here's how.
What you have to do is, if you haven't already, create a new strings file called InfoPlist.strings, then you localize this strings file to the languages you wish via the File Inspector on the right.
Now, you write down a key (for example: ADD_ITEM_SHORTCUT_TITLE or ADD_ITEM_SHORTCUT_DESCRIPTION) and the correct translation for each localized file. For example:
English file:
ADD_ITEM_SHORTCUT_TITLE = "Add";
ADD_ITEM_SHORTCUT_DESCRIPTION = "a new item";
German file:
ADD_ITEM_SHORTCUT_TITLE = "Füge hinzu";
ADD_ITEM_SHORTCUT_DESCRIPTION = "ein neues Item";
Then, go to your Info.plist and enter your key to the corresponding field. For example:
That way, you get localized UIApplicationShortcutItems. Now, they look like this:
Phone language English:
Phone language German:
Here's the scenario. I have a set of settings in an app. For example consider my app as a video player. So there are settings like allow full screen, display subtitles etc. All these settings have boolean values since you either turn on or off them.
These settings should display inside the app in a table view. And if any of them are activated or when the user taps on them to activate/deactivate, you show it by setting the checkmark accessory view of that cell.
Since I need the settings to be displayed this way and only within the app, I cannot simply use Settings bundles. There's also another catch. I need these settings to be localized.
What I initially thought was to have separate plists for the languages I support.
Settings_en.plist (English)
Settings_sv.plist (Swedish)
Then fetch the plist name depending on the system language and display its values.
let filePath = NSBundle.mainBundle().bundlePath.stringByAppendingPathComponent(NSLocalizedString("SETTINGS_PLIST", comment: ""))
But this is not ideal because say I'm running in Swedish and I change the Subtitles setting to on. Now i have to update this in both plists. This will quickly become even messier if I add more languages in the future.
Is there a better way to store settings which is easier to save and fetch and also supports localization?
I was able to find an answer elsewhere. Here are the steps taken to resolve this issue.
Instead of multiple plists, create one plist and have the keys in English language.
Then have the localized strings in your string files with the same English keys.
Localizable.strings (English)
FULL_SCREEN = "Full Screen";
SUBTITLES = "Subtitles";
Localizable.strings (Swedish)
FULL_SCREEN = "Helskärm";
SUBTITLES = "Undertexter";
In the code when you're displaying the values in a table view, refer to them by that key.
let setting = settings[indexPath.row] as [String: Bool]
let title = setting.keys.first
cell.textLabel?.text = NSLocalizedString(title!, comment: "")
I have an agent that takes a copy of a template document and puts in values from a text file.
I am running into a problem when adding a hyperlink to a field programmatically, If I just add the text (e.g. http://www.google.com) there is no hyperlink just plain text. If I add the text manually, by editing the document just adding the address works fine and is clickable.
I have tried creating a rich text object then adding that to the field but that doesn't work either :(
Set rtItem = New NotesRichTextItem( doc, "link" )
Call rtitem.AddNewLine( 1 )
Call rtItem.AppendText ("http://www.google.com")
doc.AppendItemValue "Details", rtItem
To be clear, I'm looking for a way to append a clickable hyperlink to a field using lotusscript. Any help would be greatly appreciated.
EDIT:
Upon further inspection if I generate a document with a link in the text field and save it (programmatically using doc.save) it saves as plain text, as soon as I then go into this document and do a manual save the plain text turns into a link just fine. Could something be wrong with how I am saving?
If (Not doc.save(True,False,True)) Then
Msgbox("Document could not save")
End If
It does work the way you tried in your code with just "AppendText". But, the link works only if the document is in read mode and client property "Make Internet URL ... into Hotspots" is set.
UPDATE:
AppendItemValue doesn't work for RichTextItems.
Append the link direct to your field "Details" or if it doesn't exist then create it. Your code should look like this:
Dim rtItem As NotesRichTextItem
If doc.Hasitem("Details") Then
Set rtitem = doc.Getfirstitem("Details")
Else
Set rtitem = doc.Createrichtextitem("Details")
End if
Call rtitem.AddNewLine( 1 )
Call rtItem.AppendText ("http://www.google.com")
I'm trying to get a localized index like Contacts by using UILocalizedIndexedCollation. In Contacts when I change the language the index changes to match the language. However sectionIndexTitles always returns an english index.
I have tried this with a demo app I created and with 3_SimpleIndexedTableView, which is a demo app from Apple and neither app have a localized index.
I have tried creating a localization folder for the current locale (I used [[NSLocale autoupdatingCurrentLocale] localeIdentifier] to determine the current locale). This does not affect the index.
I've had a look for relevant plist settings by found nothing.
Am I missing something or does UILocalizedIndexedCollation only return an English collation?
You can also set Localized resources can be mixed = YES in Info.plist.
If the key is missing right click and choose Add Row.
Solved!
I didn't have a localization folder in my app bundle for the target language. I added sv.lproj (Swedish) and the collation worked as expected. The folder is empty, it's presence is all that's required for it to work.