nicorac / bcr-gui

BCR-GUI is a companion app for the great BCR (Basic Call Recorder) Android application and other supported ROMs with embedded call recorders.
https://coolsoft.altervista.org
GNU General Public License v3.0
145 stars 7 forks source link

question: how does app changed calendar used based on language #27

Closed rezad1393 closed 9 months ago

rezad1393 commented 9 months ago

sorry if this is not an issue but this repo doesn't have discussions section so I had to do it this way.

this may sound stupid but I have this app installed and I have put my phone lang to Persian instead of english.

I saw that this causes this app to use Jalali calendar used in Iran instead of Gregorian calendar. and it does this automatically ( changes dates of call to jalali and back)

what setting is used in this app that does this or is it from android itself that I never saw before ?

nicorac commented 9 months ago

Dates are formatted using the standard Intl.* function available in JS (BCR-GUI is an Ionic WebApp).

The culture to be used for days/months names is the one set in Android "Language" settings.

PS: I'm working on an improvement in datetime formatting management. I could also include an option to "force" a custom culture instead of the one set in Android...

rezad1393 commented 9 months ago

dont get me wrong I love this feature and adding an option to set it per app would be icing on cake.

I was asking as a noob how this is done, and you say dates are used as Intl.* which to my untrained ears seems to mean that they are saved as universal (like unix time) and then interpreted according to language?

but the app bcr itself uses json (basically JS text) and you use that right?

nicorac commented 9 months ago

Dates are timestamps, the number of seconds (or milliseconds, depending on required precision) elapsed from 1 Jan 1970, aka Unix Epoch time. This is pretty common in the programming world to avoid issues with timezones, leap years, time interval calculations and so on...

rezad1393 commented 9 months ago

I understand that.

it is just as an Iranian I have never saw an app uses jalali calendar automatically (or even with user setting) in android and I thought that maybe (as I heard about in android 14 adding more locale stuff) maybe I have missed something in android itself, but it seems that as you say it is not android and it it is your app that does the converting.

sigh.

it may have been unintentional right? you used webapp and the webapp framework ( is that the right word?) just convert date to set language?

whatever it is , thank you I quite like it.

nicorac commented 9 months ago

Intl.* functions for a WebApp are provided by the OS WebView component; on Android it is some kind related to Chrome App.

whatever it is , thank you I quite like it.

👍