Luca's meaningless thoughts   SponsorGitHub SponsorsLiberapayPaypalBuy Me A CoffeePatreonFlattr

The LANGUAGE variable is broken for English as main language

by Leandro Lucarella on 2020- 11- 18 11:38 (updated on 2020- 11- 18 11:38)
tagged en, gettext, lang, language, linux - with 0 comment(s)

The LANGUAGE environment variable can accept multiple fallback languages (at least if your commands are using gettext), so if your main LANG is, say, es, but you also speak fr, then you can use LANGUAGE=es:fr.

But what happens when you main LANG is en, so for example your LANGUAGE looks like en:es:de? You'll notice some message that used to be in perfect English before using the multi-language fallback now seem to be shown randomly in es or de.

Well, it is not random. The thing is, since English tends to be the de-facto language for the original strings in a program, it looks like almost nobody provides an en translation, so when fallback is active, almost no programs will show messages in English.

For example, this is my Debian testing system with roughly 3.5K packages installed:

$ dpkg -l |wc -l
3522
$ ls /usr/share/locale/en/LC_MESSAGES/ | wc -l
12

Only 12 packages have a plain English locale. en_GB does a bit better:

$ ls /usr/share/locale/en_GB/LC_MESSAGES/ | wc -l
732

732 packages. This is still lower than both en and de:

$ ls /usr/share/locale/es/LC_MESSAGES/ | wc -l
821
$ ls /usr/share/locale/de/LC_MESSAGES/ | wc -l
820

The weird thing is packages as basic as psmisc (providing, for example, killall) and coreutils (providing, for example, ls) don't have an en locale, and psmisc doesn't provide es. This is why at some point it seemed like a random locale was being used. I had something like LANGUAGE=en_GB:en_US:en:es:de and I use KDE as my desktop environment. KDE seems to be correctly translated to en_GB, so I was seeing most of my desktop in English as expected, but when using killall, I got errors in German, and when using ls, I got errors in Spanish.

If you don't provide other fallback languages, gettext will automatically fall back to the C locale, which is the original strings embedded in the source code, which are usually in English, and this is why if you don't provide fallback languages (other than English at least), all will work in English as expected. Of course if you use C in your fallback languages, before any non-English language, then they will be ignored as the C locale should always be present, so that's not an option.

I find it very curious that this issue has almost zero visibility. At least my searches for the issue didn't throw any useful results. I had to figure it all out by myself like in the good old pre-stackoverflow times...

Note

I know is not a typical use case, as since almost all software use English for the C locale it hardly makes any sense to use fallback languages in practice if your main language is English. But theoretically it could happen, and providing an en translation is trivial.

Elephone P9000

by Leandro Lucarella on 2020- 11- 18 11:10 (updated on 2020- 11- 18 11:10)
tagged android, elephone, en, p9000, phone, review - with 0 comment(s)

Note

This post is really old (May 2016), but was never published for some reason. I'm publishing it now just as an archeological artifact :)

I usually don't do reviews for anything, but I want to write a few points about this phone, in part for folks out there to know, but also as some sort of internal reminder of the things I've been finding.

I should say before anything else that I'm basically comparing this phone against my previous one, a Samsung Galaxy S4 (I9505) using CyanogenMod.

The Elephone P900 is a super tempting device. Here are the main reasons why I chosen this phone (in bold my hard requirements, in italics things I didn't really care about but it was a good opportunity to try out):

  • It has 4GB of RAM and fast CPU (octacore)
  • It supports memory expansion (micro SD up to 256GB 8-)
  • It has a very high screen to body ratio (about 83%, for comparison the Nexus 5 has 71% and the iPhone 5s has 61%). I was looking for a 5 inch phone, so to go for a 5.5 inch one, the overall size of the phone had to be as small as possible.
  • It has USB Type-C (I thought if I'm getting a new phone, better to have the new shiny no-non-sense connector)
  • It comes with Android 6 (I want either that or to be supported by CM)
  • Decent battery (3000mAh, which I expected to last for a full day of intensive use)
  • It has at least one "navigation button" (I don't want to lose part of my screen with software buttons)
  • It has a Sony camera sensor with f/2.0 and laser focus, which is supposed to be of decent quality really fast to do focus. That said, I read some reviews not speaking well about the camera
  • It has a rouged back (my S4 was a bit slippery)
  • It costs less than €250 (here in Germany)
  • It has wireless charging and quick charging
  • It has a fingerprint reader
  • It has a quite high-res frontal camera (8 megapixel)
  • It supports dual-SIM although the second SIM shares the slot with the memory expansion, so is not something I'll be able to use anyway

So, after using it for about a couple of days, these are my findings:

The good:

  • The build quality is very nice, it really looks like a high end phone. More than my old S4 (which is made of plastic, while the P9000 is metallic).
  • Is very light, even when it's a few grams extra compared to the S4, you can't really feel it. For offering 0.5 extra inches of screen is quite impressive.
  • It is fast. I wasn't expecting to notice a difference with the S4 really, basically because I don't feel the S4 is slow. But you can tell the difference. The P9000 is snappier.
  • It looks beautiful (at least for my minimalistic taste). I never care much about looks, but I really like this phone (much more than the S4).
  • Despite the big screen and feeling a bit too big at first, the size seems manageable and the extra screen space is useful.
  • Now having a fingerprint reader will probably be a requirement for my next phone. I encrypt my phone and use a longish password to unlock it. Being able to unlock it securely with just one touch is a huge gain.
  • It can be rooted. It took me a while to find the right flasher for Linux (you need the latest version of it), but I could do it, and even TWRP is available for it already, which gives me some hope about better ROMs, and maybe even CM, appearing in the future.

The Bad:

  • The fingerprint reader sucks. I've seen a video review complaining about it, and even for this guy complaining it worked much better than for me. I would say in my case it succeeds reading my fingerprint about less than 20% of the time. I even registered my fingerprint like five 5 times, using different finger positions and it still fails most of the time, and after 3 or 5 failures you have to wait 30 seconds before being able to retry.
  • The screen is not bright enough for a sunny day. You can still see the screen, but it's not as bright as the one in my old S4.
  • The camera pretty much sucks too. The f/2.0 I don't know where is it, pictures are always quite noisy. The auto-focus is not faster than my old S4. The sensor is supposed to be good, so I guess they just screwed it with the lenses. Or maybe is a firmware thing? But I doubt it.
  • The sound really SUCKS. I never thought about it before. Even when I listen to music a lot, I never had a good year and never could pick up on bad quality recordings for example. Is a blessing. But with this phone I noticed. It sounds like crap (and I'm not talking about the speaker, which is understandable, I'm talking about plugging earphones). When I noticed I thought it might be the album. I tried another one, and another one, and finally I compared the same files in my old S4 and... Oh boy. This new phone's audio just SUCKS SO BAD. It's the phone. I would say this was the final deal breaker for me.
  • The battery can't take an intense full day of usage. It's basically the same as my old S4 (and I want an improvement on this area). If I use it just for a few messages and most of the time inside with WiFi, it can last 2 full days. If I take it outside using mobile data, and listen to music during a hold day, it barely last for a day. If I add to that using maps and the GPS having the screen on more time, like when I'm traveling, it can barely last more than half a day.
  • The Android version is missing some features that I thought it was pure Android (not CM), like the Ambient Display (shows notifications in a dimmed screen), the LiveDisplay (adjust the screen color temperature according to the time of the day) and the Do Not Disturb mode(s). The keyboard doesn't support swiping (major drawback for me).
  • The touchscreen is not very sensitive. I can tell the difference with the S4. Maybe the one in the S4 is too sensitive, sometimes it reacts without even contacting the glass, but in the P9000 sometimes I feel I have to press the glass too much to get it reacting. Some gestures are harder to do because of this (like swipe-up to unlock).
  • Only one navigation button. Even when is better than nothing, I found much more convenient having 3 navigation buttons like the S4 provides.
  • No multicolor notification light. The navigation button on the bottom also serves as a notification light, but it has only one color and the frequency can't be configured either (AFAIK). The S4 has a multi-color led, which let you know what kind of notification is there before you even look at the screen.
  • USB Type-C is not popular enough yet. Even when this is not the phone's fault, I realized we are not there yet. Micro USB cables are everywhere out there. You'll never miss one. With Type-C you better carry your cable everywhere or buy a bunch, because you are all alone now.

So, even when the external quality is amazing and, even when I never cared about looks, it looks extremely nice too, it looks like the low price tag has to come from somewhere, and that somewhere is the internal components, which seems like they are not the best.

Still the quality-price ratio is quite impressive IMHO, on paper you have the same specs as an iPhone 6, or Samsung S7, at less than half the price. But I think I prefer to spend an extra few bucks to get higher internal components qualities (specially with the sound), so I will probably return this phone and continue looking for one. Also I miss my CM too much. I think I will have to settle for an older phone that's is supported by CM.

TODO:

  • Fingerprint unlock and screen gestures makes the phone never enter deep sleep, nice features but until it's fixed it might be better to disable them, at least when you know you'll need some juice.
  • Fingerprint starts working better after some use (only 2 or 3 attempts are needed)
  • WiFi consumes more battery than mobile data (WTF!?)
  • RoDrIgUeZsTyLe™ MODPACK V1.1
    • Sound is saved (probably is not amazing, but I don't notice the obvious creepiness anymore). Praise the Lord!
    • Touchscreen is more sensitive, not as the S4 but definitely an appreciable improvement.
    • Battery life improved a lot. One day of moderate activity (for me) and still about 65% battery left. I used the phone for 12 hours after fully charged, and my usage pattern was: about 6 hours outside (using mobile data), about 40 minutes of music playing + GPS working in high accuracy mode. The rest inside using WiFi. I also did some messaging and internet use, but nothing too intensive. BetterBatteryStats reports: 66% (~8h) deep sleep (which is still low, I wonder what this phone could last if it were more aggressive about going to deep sleep), 8% (~1h) screen on. Wifi running 100% of the time (~12h). Battery consumption average was 3%/h. My guess is that with a similar usage, the S4 I would probably ended the day with not more than 30% or 40% battery.
  • Ways to improve the battery life and fix other stuff: Xposed framework, but not supported yet. For example with "Amplify Battery Extender" I could disable the wakelock for the fingerprint or NlpWakelock. Wakelock Terminator might also help (also needs Xposed)
  • For now using DisableService to disable NlpService from MTK NLP Service, the location seems to keep working fine. Another option is to put the GPS in device-only mode to avoid the NPL service from running.
  • Install Xposed using Eragon 2.0 ROM:
    1. Install Xposed Material installer (3.0 alpha4) http://forum.xda-developers.com/xposed/material-design-xposed-installer-t3137758
    2. Edit /etc/init.d/07permissive and comment out the sleep 60
    3. Install Xposed framework v82 (not a newer one otherwise settings will force close)
  • Battery life saved via update from 2016-05-31. Fingerprint reader and WiFi don't keep the phone awake anymore (5~10% awake when screen is off with both enabled).

Simplicity

by Leandro Lucarella on 2016- 04- 01 22:58 (updated on 2016- 04- 01 22:58)
tagged en, simplicity - with 0 comment(s)

This is mostly an article I want to save for myself about simplicity. It was originally written by Mark Ramm in the context of a Python web framework I used (TurboGears). The original article seems to be gone, but you can still find it in the Archive.org's Wayback Machine.

Here is a transcription:

What is Simplicity?
(May 31st, 2006 by Mark Ramm)

Simplicity is knowing when one more rock would be too many, and one less rock would be too few. But it’s not just knowing the right number of rocks, it’s also knowing which rocks are right, and how to arrange them.

As Brad reminds us, simplicity is not achieved merely by making something easier, or less complex.

Take away all the complexity, all the difficulty, and all of the details from anything and what you are left with is not simple: it’s just boring.

On the other hand, Simplicity embraces exactly the right details, the right difficulties, the right complexity, but because everything is tied together in the right way, you are left with a sense of clarity, and a sense that everything belongs exactly where it is. Simplicity is achieved when everything means something.

In other words, simplicity is defined by what you add — clarity, purpose, and intentionality — not by what you remove.

For those of us who write software, simplicity is not a simple thing to learn. Writing the TurboGears book and working with the amazing group of people who contribute to the project has been a learning experience for me. Everybody is focused on making the web development simpler — and it’s amazing how much experience and depth of understanding is necessary to create a simple interface. It’s easy to build an interface that solves 80% of the problem, or an interface that solves 200% of the problem, but it is hard to solve just the right problem, and to do it in a clean, clear, way.

Of course, every project has warts, and TurboGears re-uses other projects which also have warts. So there’s no way I can say that TurboGears has arrived. But the will is there, and the journey sure has been productive for me.

Día de la condena errada

by Leandro Lucarella on 2015- 09- 26 20:32 (updated on 2015- 09- 26 20:32)
tagged día de la condena errada, es, innocent project argentina, política - with 0 comment(s)

El Día de la Condena Errada es creado como un Día Internacional destinado a reconocer los daños tanto personales como sociales e institucionales asociados a las condenas erradas, y a informar y concientizar a toda la comunidad internacional sobre sus causas, consecuencias y otras problemáticas asociadas a ellas.

¡Sumate a difundir el Día de la Condena Errada!

Apoyemos a las personas inocentes privadas de su libertad. Cambiemos el sistema penal juntos! #IWCD2015 #DICE2015

Incredible Machine - Hurricane Heart Attacks

by Leandro Lucarella on 2015- 08- 25 08:12 (updated on 2015- 08- 25 08:12)
tagged bandcamp, en, es, hurricane heart attacks, incredible machine, music, streaming - with 0 comment(s)

The Black Keys - Turn incompressible

by Leandro Lucarella on 2014- 05- 06 22:33 (updated on 2014- 05- 06 22:33)
tagged 2014, album, black keys, compression, en, jpg, music, png, the black keys, turn blue - with 0 comment(s)

Maybe you heard about the new album from The Black Keys. Maybe you didn't. In any case, I don't want to talk about the album (which is good BTW), I want to talk about the album cover:

The Black Keys - Turn Blue album cover

See how bad it looks? Now click on the image and see how good it looks (in terms of quality, the album cover is pretty ugly anyway :P). The thing is, this stupid pattern is very hard to compress, so even using a JPG quality of 90%, you get a quite big file size and a pretty crappy image quality (126KB for a 500x500 image is quite a lot, 294KB for PNG using compression 9). If you look at the big image, even the colors are different, so the image makes resizing algorithms also go nuts, the image looks darker (or is this just an ilusion because of the changed relationship between both colors?).

Try it yourself, download the image, resize it, save it with different formats and qualities.

Coincidence? I guess not.

The Day We Fight Back

by Leandro Lucarella on 2014- 02- 10 18:59 (updated on 2014- 02- 10 18:59)
tagged activism, en, nsa, politics, surveillance, the day we fight back - with 0 comment(s)

On Anniversary of Aaron Swartz's Tragic Passing, Leading Internet Groups and Online Platforms Announce Day of Activism Against NSA Surveillance.

Participants including Access, Demand Progress, the Electronic Frontier Foundation, Fight for the Future, Free Press, BoingBoing, Reddit, Mozilla, ThoughtWorks, and more to come, will join potentially millions of Internet users to pressure lawmakers to end mass surveillance -- of both Americans and the citizens of the whole world.

https://thedaywefightback.org/

Oscar

by Leandro Lucarella on 2013- 12- 17 20:26 (updated on 2013- 12- 17 20:26)
tagged en, marlon brando, oscar, politics, protest, sacheen littlefeather, video, youtube - with 0 comment(s)

First Flattr

by Leandro Lucarella on 2013- 11- 16 00:24 (updated on 2013- 11- 16 00:24)
tagged cc, en, flattr, free culture - with 0 comment(s)

9 months ago I decided to try Flattr. I created an account, put some money on it, started flattring and made myself flattrable. But nothing happened. Also sometimes you don't know if the people you are flattring will even reclaim your flattrs (in services that automatically provides flattr links).

Conclusion, I got quite disappointed. But today I see the light again, as I received my first and only flattr (for eventxx). Thanks whoever you are, anonymous hero, you brought hope again to humanity :P

Anyway, I'll try to give it a shot again, and try to keep the wheel moving.

You should do that too.

Obvio

by Leandro Lucarella on 2013- 07- 23 16:54 (updated on 2013- 07- 23 16:54)
tagged 1/60s, 2013-05-26, 5.0 mm, aperture-priority ae, cactus, canon powershot sx210 is, cartel, daylight, f/3.1, iso200, no tocar, obvio, photo, pic - with 0 comment(s)

No tocar

En una exposición de cactus.

2013-05-26 17:05:11 CEST
[ Canon PowerShot SX210 IS 1/60s f/3.1 iso200 5.0 mm Daylight Aperture-priority AE ]

Better Call Dominguez!

by Leandro Lucarella on 2013- 07- 22 17:19 (updated on 2013- 07- 22 17:19)
tagged 1/125s, 1/60s, 2013-04-29, 5.0 mm, 6.6 mm, aperture-priority ae, attourney, auto, breaking bad, california, canon powershot sx210 is, f/3.1, f/3.5, humour, iso320, iso80, la, los angeles, photo, pic, series, tv, usa - with 0 comment(s)

Seems like this is the real Saul Goodman!

On a bus

On a bus

2013-04-29 11:18:01 CEST
[ Canon PowerShot SX210 IS 1/125s f/3.5 iso80 6.6 mm Auto Aperture-priority AE ]
On the metro

On the metro

2013-04-29 11:50:21 CEST
[ Canon PowerShot SX210 IS 1/60s f/3.1 iso320 5.0 mm Auto Aperture-priority AE ]

Signs like these were all over the streets in LA.

Radiohead Nude via zx80+printer+scanner+hdd

by Leandro Lucarella on 2013- 04- 13 20:53 (updated on 2013- 04- 13 20:53)
tagged en, es, espon lx-86, hdd, hp scanjet 4c, matrix, music, nude, printer, radiohead, scanner, spectrum, video, youtube, zx80 - with 0 comment(s)

Fucking awesome, be patient for the first minute...

The Money Myth

by Leandro Lucarella on 2013- 02- 21 21:13 (updated on 2013- 02- 21 21:13)
tagged currency, en, jem bendell, money, ted, tedx, the money mith, video, youtube - with 0 comment(s)

Flattr

by Leandro Lucarella on 2013- 02- 17 21:02 (updated on 2013- 02- 17 21:02)
tagged cc, en, flattr, free culture, the pirate bay, tpb, tpb afk - with 0 comment(s)

I learned that Flattr, a social micropayment service that I've been overlooking for a long time, was created by some of the founders of The Pirate Bay after watching TPB AFK.

I'm trying to donate (or pay) more and more to people using alternative means to produce stuff, like artists using CC licenses or software developers working with free licenses (I already bought a copy of the movie :). I feel like I have to get more involved to keep the wheel spinning and help people keep doing stuff, cutting the intermediaries as much as possible.

I don't know why I had some resistance to get into Flattr, maybe is because Facebook made me hate anything that have a thumbs up, or a +1 or counter, but knowing the history behind it a little better encouraged me to finally get an account and start using Flattr. And is really nice. Is much easier than going through Paypal each time a want to give some bucks to someone, and allows you to even make very small donations.

I recommend to see this introductory video:

I also decided to flattr-ize all my website, each project individually and even this blog. Not exactly for economical reasons (I think very few people know about anything I do so I don't really expect to earn any money from this), but as another way to spread the word. Also, I'm really curious about what I just said, I really wonder if there is someone out there grateful enough to make even a micro-donation to anything I do or did :)

Anyway, I would like to recommend to do the same, if you do something great, add a Flattr button to what you do, and if you like something out there and it has a Flattr, click it. Let's see if it helps to keep the wheel spinning :)

TPB AFK

by Leandro Lucarella on 2013- 01- 13 20:01 (updated on 2013- 01- 13 20:01)
tagged away from keyword, cc, documentary, en, es, movie, p2p, the pirate bay, tpb, tpb afk, trailer - with 0 comment(s)