Localization Strings not shown in SwiftUI - swift

I was making my doc of string for Localization in SwiftUI, but I noticed that some string are nos showing correctly, like if they didn't exists. I thought that it was because I have mi localization file in my main folder, and my ViewFile is in a subfolder, so I created another strings file in my subfolder and localized it but it didn't worked (all is indicated in red).
But a string is showed correctly in my Setting View that it's in another subfolder (indicated in green).

Related

Notification Service Extensions with NSLocalizedString

I am using Notification Serivce Extension to change the text coming from the server as per what I Want.
However, that was working good with normal strings. but when I used NSLocalizedString with it, it dosent show the localized string, instead it shows the field name of the string.
For example: inside the UNNotificationServiceExtension:
let CompanyViewLM = NSLocalizedString("Notifications.View", comment: "No Comment")
and in Localizable.strings I put the following line:
Notifications.View = "I Viewed your profile";
Noting that I put the same lines of code in a normal view controller and it works just fine.
I Found by my self what was the problem.
The notification service target was working in the project without recognizing other files of the project.
To make it recognizes other files you must go to targets -> NotificationService -> Copy Bundle Resources -> add the files you want the notification service to work with.
In my case, I added the Localizable.strings file and it worked as a charm.

Strange issue with en.lproj

I am getting strange issue with localizable strings. I have added few localizable strings in en.lproj and accessing them using NSLocalizedString(localizablestringname,nil);
The issue is, sometimes it gives value of localizablestringname and sometimes it does not give any value when I run the application.
For example, I have added "appTagsTitle" = "Tags"; in localizable strings, and I used appTagsTitle to be displayed on screen, sometimes it displays "Tags" on screen and sometimes it gives "appTagsTitle" on screen, so it looks like, sometimes localized strings does not work properly.
What am I doing wrong?
Thanks In Advance.
I have solved it, somehow resources for English Localizations were showing 2 files, check attached image. then, I deleted localizations and added again, the problem was solved.

Localized XIB not showing all IBActions, outlet & images

i m getting a problem with my localized xib.
I have created english version xib first, then made them localized, & added other localization.
it works fine in app also.
But when i open other language xib with IB, i m unable to get all outlets & IBActions.
It seems like it is taking only those one that were present when i created the localized file, & not showing newly added one.
Does file not getting updated?
Note : My other team member done the same thing & they don't have problem.
i also tried to removed & created all new localized file then also no change.
I m unable to identify the problem, i m stuck on this problem & cannot proceed with further development.
Please help .. :(
If you have Xibs in different languages, they don't get updated automatically when you change the English one.
Instead, you should either merge the new changes using ibtool (type man ibtool in Terminal to learn its options), or use a dedicated application like iLocalize.
In general, it can be quite an issue to update all the localizations all the time and sometimes large changes can't be merged well automatically. You need to be careful about that.

Localizing other pages in Settings.bundle

I have other pages within my app preferences which are stored as separate files within the settings.bundle.
It has come time to localize my app and I can only seem to get the Root values to localize. I was wondering whether there was a trick?
The following image shows that my second screen is stored within a file called "MyPrefs.plist" and I have created a corresponding named file "MyPrefs.strings" in the en.lproj directory. Mirroring the same naming and location as the Root.plist and Root.strings.
The values with the Root.plist are converted as expected but not in the extra screen.
Is there any trick to localizing secondary screens with the settings.bundle?
Have you set the correct value for Strings Filename key in the MyPrefs.plist file ?
It should look like:
+ iPhone Settings Schema
Settings Page Title MyPrefs Title
Strings Filename MyPrefs
+ Preferences Items
....

Can I change the icon title on the iPhone home screen without changing the application name?

The name of an app we are developing is longer than can fit under the icon on the home screen, but it looks fine everywhere else it appears in the UI (like when a popup appears asking you if you want to delete it, in the settings app, etc.).
Is there any way to specify a different string for these different places?
You can specify two different bundle names in your Info.plist:
CFBundleDisplayName:
CFBundleDisplayName (String) specifies
the display name of the bundle. If you
support localized names for your
bundle, include this key in both your
information property list file and in
the InfoPlist.strings files of your
language subdirectories. If you
localize this key, you should also
include a localized version of the
CFBundleName key.
CFBundleName:
CFBundleName (String) identifies the
short name of the bundle. This name
should be less than 16 characters long
and be suitable for displaying in the
menu bar and the application’s Info
window. You can include this key in
the InfoPlist.strings file of an
appropriate .lproj subdirectory to
provide localized values for it. If
you localize this key, you should also
include the key “CFBundleDisplayName.”
In Xcode these show up as "Bundle display name" and "Bundle name" respectively.
So just change the value of Bundle name to a shortened form and see if the dashboard uses that instead of the longer Bundle display name
Except for localized application names, I'm not aware of any option to specify different application names for different contexts.