abranson / rockpool

Pebble client application for Sailfish OS
41 stars 19 forks source link

.pbl language packs support #23

Closed a-andreyev closed 8 years ago

a-andreyev commented 8 years ago

It is possible to apply language packs via android and ios. Would be great to add this feature.

P.S.: thanks a lot for your work!

abranson commented 8 years ago

I think Pebbled could handle this too.

petRUShka commented 8 years ago

Yes, same request!

abranson commented 8 years ago

The support in Pebbled wasn't as advanced as I'd hoped, there's just example code: https://github.com/smokku/pebble/blob/master/daemon/bankmanager.cpp#L11 This might be enough though. I'll see what it does. Anyone know where you get pbl files from?

petRUShka commented 8 years ago

There is list of seems to be unofficial language files: https://github.com/MarSoft/pebble-firmware-utils/wiki/Language-Packs

I believe it is possible to intercept request from Pebble Time for Android or iOS to their pebble server.

petRUShka commented 8 years ago

I found link here to seems to be old official pbl files: http://lp.getpebble.com/v1/languages

petRUShka commented 8 years ago

I wrote email to @MarSoft. I hope he will cast light on that subject. If there will be any updates I will redirect them here.

MarSoft commented 8 years ago

Actually, the link @petRUShka privided above is still the/ actual one. In Android APK of Pebble Time app there is a default_boot_config.json file which defines this link as well as list of known languages for voice recognition: (I write this in JS syntax for simplicity)

config.links["i18n/language_packs"] = "https://lp.getpebble.com/v1/languages";

Under this link there is a JSON endpoint which returns something like this:

{"languages": [
    {
        "ISOLocal": "ru_RU",
        "hardware": "ev2_4",
        "file": "https://language-packs.s3.amazonaws.com/sNN1m33-ru_RU.pbl",
        "name": "English+Russian",
        "localName": "English + Русский",
        "firmware": "3.8.0",
        "version": 3,
        "mobile": {
            "name": "ios",
            "version": "2.6.0"
        },
        "id": "56b28b6ce21e461b00734c16"
    },
    ...
]}

As far as I can see, you just need to fetch this list, find entries corresponding to current watch's hardware version, and then (after user choose locale) just fetch file from url in file field. For what I could see, firmware and mobile fields are not necessary to check.

abranson commented 8 years ago

Yes, I noticed that none of the firmware version numbers don't correspond to the current one (v3.10.1). Looks like it might be a last modified version. Katharine kindly gave me some pointers in the telegram chat too, so I'll look there too. Thanks very much.

abranson commented 8 years ago

It seems that the example language upload code from pebbled doesn't work, although maybe it did for the v2 firmware. I can't seem to get anything by NACKs back from the watch. I'll see if I can find out the right way to do it. Any tips would be welcome...

petRUShka commented 8 years ago

@MarSoft, do you have any code examples of uploading .pbl to pebble?

MarSoft commented 8 years ago

Unfortunately no, the only thing I could suggest is to try reversing Pebble's android application... Did you try to simply send it as if it would be a firmware bundle? According to my investigations in apk internals, they associate some numeric value with various types of uploadable resources: firmware(.pbz) is 1, app(.pbw) is 2, language(.pbl) is 3, and unknown type (.error) is 0. May it helps.

abranson commented 8 years ago

I have this enum in the source, which comes from libpebble2. It doesn't seem to overlap with that list past the first one.

enum UploadType {
    UploadTypeFirmware = 1,
    UploadTypeRecovery = 2,
    UploadTypeSystemResources = 3,
    UploadTypeResources = 4,
    UploadTypeBinary = 5,
    UploadTypeFile = 6,
    UploadTypeWorker = 7
};

I was trying UploadTypeFile, as suggested by the pebbled source. Maybe I should try UploadTypeSystemResources, but that seems to be the firmware's resources.