Git Product home page Git Product logo

android-locale-hack's Introduction

android-locale-hack


These are my notes on hacking around the problem of getting the default locale in a Python application running on Android, including a simple example on the best method I've found so far.

Android's builtin version of libc, called bionic, doesn't have any concept of locale. Usually, when (cross-)compiling Python for Android, a patch for removing any parts of the Python source which mention LC_* is used before (cross-)compiling.

Another method for working around the locale problem on Android is in Google's alpha version of python3-for-android, which ships an alternate locale module that tries to import _locale from the standard library, and if that fails, it falls back to emulating a normal libc's C-Types for LC_* in a series of Python functions.

fuck android


I don't want to fix a crappily designed operating system. I just want the Python apps that I write for normal systems that use a normal libc to just fucking work. Therefore, I'm resorting to cheap hacks.

One way to hack around this is to use pyjnius to wrap the java.util.Locale class in a Python class, and use the Python wrapper to ask AOS's JVM for the default locale. See locale-hack.py for a working version of this, which I ran on QPython (and here is QPython on the Google Play store) simply because it provides easy download of pyjnius.

android-locale-hack's People

Contributors

isislovecruft avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.