san88
san88

Reputation: 1384

PhoneGap Custom Language setup

I have tried many examples and non of them are work.Here is what i want to do. I have a phonegap eclipse project.here is the project structure

enter image description here

I want to add custom language for my project. here is my MainActivity.java

import org.apache.cordova.DroidGap;

import android.os.Bundle;

public class MainActivity extends DroidGap {


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        super.loadUrl("file:///android_asset/www/index.html");

 }
}

Here is my index.html

 <!DOCTYPE html>
 <html>
  <head>
  <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-   scale=1, minimum-scale=1, width=device-width;" />
  <title>Directory Reader</title>
  <link rel="stylesheet" href="jquery/jquery.mobile-1.1.1.min.css" />
  <script src="jquery/jquery-1.8.0.min.js"></script>
  <script src="jquery/jquery.mobile-1.1.1.min.js"></script>
    <script type="text/javascript" src="cordova-2.0.0.js"></script>

  <style type="text/css">
  @font-face {
   font-family: MyCustomFont;
   src: url("NotoSansSinhala-Regular.eot") /* EOT file for IE */
  }
   @font-face {
   font-family: MyCustomFont;
   src: url("NotoSansSinhala-Regular.ttf") /* TTF file for CSS3 browsers */
  }

  body {
  font-family: MyCustomFont, Verdana, Arial, sans-serif;
  font-size: medium;
  color: black
  }
  </style>


 </head>
 <body>

 <p> test goda </p>
 </div>
 </body>
 </html>

Still font that i want to display is not showing on the mobile device.its shows english characters "test goda". any idea how to slove this?

Upvotes: 0

Views: 48

Answers (1)

KOTIOS
KOTIOS

Reputation: 11194

You would basically need to root the device to install Sinhala text on Android 4.4 , but it works on Android 5.0+

You would basically need below steps :

  1. Copy the font files to /system/fonts
  2. Download the fallback_fonts.xml file from /etc
  3. Open the fallback_fonts.xml file and modify it by adding your font names .Copy the file back to the /etc directory.
  4. Change the permissions of your fallback_fonts.xml file AND the font files to 644 or -rw-r–r–

Plese see read instructions with screenhots here

Upvotes: 1

Related Questions