expo-image-picker translate buttons on iOS - react-native

I need to change the text (translate to my language) when the user choose to take a photo from camera on iOS. I didn't find anything in docs. On android the buttons appear with the language configured on the device, but on iPhone the text of the buttons always appears in English. I would like to be able to change the language of these buttons

I had the same problem and found a solution on a Github issue.
You can fix it by setting the CFBundleDevelopmentRegion to the language of your app in the app.json config:
"expo":{
...
"ios":{
"infoPlist":{
"CFBundleDevelopmentRegion":"de"
}
}
}
The property accepts any two-letter ISO 639-1 language code (like "en", "de" or "ja") or a three-letter ISO 639-2 code.

Related

Using international characters in React Native

I have the following international text in my react native app:
<Text>ᚘᚘᚘ</Text>
However, a blank line is displayed to my screen where the text should go. I have tried for other international characters as well and it is the same result.
I am using notepad++ and making sure that encoding is set to UTF-8. If I use console.log("ᚘᚘᚘ") it displays to the console just fine. Do I specifically need to embed a particular unicode font in my React Native project for it to work correctly? Or what should I be doing so that it displays my text correctly?
On further investigation I am using a Samsung Galaxy S2 for testing purposes. It does not seem to handle unicode characters in all applications, so I think my app will not work in older devices unless I specifically embed a Unicode font. Am I correct in my thinking?
The only solution I found to this was to add a custom font. This link explains how to use a custom font: https://blog.bam.tech/developper-news/add-a-custom-font-to-your-react-native-app . The font I used is called GNU FreeFont located here: https://www.gnu.org/software/freefont/

FontFamily not working in Android Device in React-Native

I have added many font-family and style into my asset folder in React-Native project. It's working fine in simulator, emulator, and iOS device. But some font won't work and not display in Android device.
I have try with react-native link and check the asset folder in Android app directory, nothing missing.
Anyone help please.
I might have a solution for this. I had the same problem, the fonts were visible in my emulator, the font files are located under 'android/src/main/assets/fonts' and yet it wasn't visible on my physical android device (Huawei Honor 8X).
I found out that the problem was with my physical device's Font settings. To fix this, on your phone, go to
Settings -> Display -> Text Style -> Default
Settings screen : Go to Display
Display settings : Look for Text Style, Make sure it is set to default as seen in the pic
Select Default here : Now your custom app fonts should work
Please Note that these settings might differ as per your device. I've mentioned the steps for my phone.
Always use the default Text Style to render custom fonts in your app.
Nowadays, phones like the OnePlus etc. have their own custom fonts and I think this is interfering with custom fonts defined in Applications.
Hope this helps.
Following this article worked for me. The name of the font file name is important to get it working on both platforms.
I had multiple font files with different weights (Circular Std Bold, Circular Std Medium etc..) for these to work on android I dynamically changed the font family style to this name to change the weight.
The font weight style on android didn't work for me.
the problem is with devices that have custom font style like huawei devices. I hope there be a solution for this to not force the user to change it's device font style because of our app.
My font family changes when I connect to my android device but I finally figured out how to fix it. If font weight is set then it changes the font on my device to its default font. After I removed font weight my android devices default font isn't applied anymore.
fontFamily its not work in inlinstyle you must change from
<Text style={{fontFamily:'SantPro'}} />
to
Text style={styles.text}
const styles = StyleSheet.create({
text: {
fontFamily:'SantPro',
},
})

CFBundleDevelopmentRegion not working

I've added several localizations to my app.
English
Japanese
zh-hans
zh-hant
and I set value "English" in the key CFBundleDevelopmentRegion at info.plist file.
When download app on iOS7 and I change system language from Japanese
to other language (ex. korea), my app show me Japanese.
Another, When change from zh-hans to other language,
my app show me Japanese.
It is not expected and It happen only iOS7.
How to set default language on iOS7 ?

iOS7 app locale won't show Chinese app name and splash screens

An already existing iOS app of a client is now being localized for various languages.
I localized the storyboard, InfoPlist.strings, Localizable.strings, splash screens and icons.
For the English, Spanish and Dutch languages the app name gets translated, as well the settings screen.
However, for the Chinese languages (both Traditional and Simplified) the name of the app (as being displayed below the app icon and in settings) remains what is set by the base localize InfoPlist.strings The splash screens also won't change
Everything else (Storyboard, translating strings through code) gets translated as normally.
For the testing of the translations the simulator is being used.
This is in my InfoPlist.strings file for Chinese Simplified:
"CFBundleDisplayName" = "Simplified";
The file is located in zh-Hans-CN.lproj
For the Traditional InfoPlist.strings file the content is similar, and the location is zh-Hant-TW.lproj
Both files were auto generated by Xcode 5.1
In the same directory the Localizable.strings are also present, and those files get loaded correctly.
Any suggestions?
You should localize for the general Chinese languages zh-Hans.lproj and zh-Hant.lproj not the special Chinese Simplified (China) and Chinese Traditional (Taiwan)

Setting parts of a String to Bold in UIView

I'm parsing an XML file an get a string as NSMutableString.
Now I want to show this string as text in my UIView.
So, I created a TextView and set its value to my string. The result was that I have the text with HTML Tags shown up in the TextView.
There is no problem removing the tags from the string, but some of the text needs to appear as bold.
Is there any way to display parts of a string as bold programmatically?
I replaced <br> Elements with \n and it works fine for line-break.
But I still don't know what I can do to display words between strong tags as bold in the UIView.
There are two ways. The first is by displaying them in UIWebViews; prior to iOS 4.1 this was effectively the only way. Because you already have HTML codes in the text, it would certainly be easy.
If you're ok with your app running only on iOS 4.1 and up you can use Core Text, which provides very rich formatting.
EDIT
Apple provides some good resources:
About Text, Web, and Editing Support in iOS
Core Text Programming Guide
WWDC 2010 Session Videos -- follow the link to iTunes and grab session 110: Advanced Text Handling for iPhone OS
(Apple Developer login required)
You may use UIWebView and load your content from an NSString object.
Anyway if you want to stick to Cocoa, have a look to NSAttributedString.