Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last connected Dex status page English only #3303

Closed

Conversation

Navid200
Copy link
Collaborator

@Navid200 Navid200 commented Jan 21, 2024

Please lets have this in English only the same as everything else on the same page as well as all the logs, so that the support staff can do their job without having to constantly look for a translator.

@Navid200
Copy link
Collaborator Author

Navid200 commented Jan 21, 2024

This is an example of what we see in the facebook group:
420175018_10163676423846515_6389554714124573967_n

So, imagine you see 27 and something that is a unit in another language. Now, is that 27 seconds or 27 minutes?
Last connected 27 seconds ago is great. Last connected 27 minutes ago is bad.

@Navid200
Copy link
Collaborator Author

Navid200 commented Jan 21, 2024

The following shows my test result after this PR for the same language I believe.
Screenshot_20240120-225024

@Navid200
Copy link
Collaborator Author

Navid200 commented Jan 21, 2024

I don't care as much about when the battery was last checked or the number of days on the sensor.
But, last connected, please let me have it in English.

@Navid200
Copy link
Collaborator Author

It's not just the time it takes to look for translations. It could lead to mistakes also.

@Navid200
Copy link
Collaborator Author

Please review this PR.
422870385_10228651844815253_1862521954198849538_n

Der-Schubi added a commit to Der-Schubi/xDrip that referenced this pull request Feb 8, 2024
Merge remote-tracking branch 'Navid200/Navid_2024_01_20' into schubi
unit = "day";
t = t / 24;
if (t != 1) unit = "days";
if (t > 28) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why t > 28?! should it be t > 7
Please check if this is an error

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though it may look like I am adding this code, I am not.
I have copied an existing code, removed translation strings from it, and replaced them with English text.

Your questions should be posed with respect to the original existing code here:

public static String niceTimeScalar(double t, int digits) {
String unit = xdrip.getAppContext().getString(R.string.unit_second);
t = t / 1000;
if (t != 1) unit = xdrip.getAppContext().getString(R.string.unit_seconds);
if (t > 59) {
unit = xdrip.getAppContext().getString(R.string.unit_minute);
t = t / 60;
if (t != 1) unit = xdrip.getAppContext().getString(R.string.unit_minutes);
if (t > 59) {
unit = xdrip.getAppContext().getString(R.string.unit_hour);
t = t / 60;
if (t != 1) unit = xdrip.getAppContext().getString(R.string.unit_hours);
if (t > 24) {
unit = xdrip.getAppContext().getString(R.string.unit_day);
t = t / 24;
if (t != 1) unit = xdrip.getAppContext().getString(R.string.unit_days);
if (t > 28) {
unit = xdrip.getAppContext().getString(R.string.unit_week);
t = t / 7;
if (t != 1) unit = xdrip.getAppContext().getString(R.string.unit_weeks);
}
}
}
}
//if (t != 1) unit = unit + "s"; //implemented plurality in every step, because in other languages plurality of time is not every time adding the same character
return qs( t, digits) + " " + unit;
}

If your questions and suggestions are accepted, the original code as well as my copy can be modified.
If your suggestions are not accepted for the original code, I don't see why they would only apply to my copy.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw pull request and made code review. That is all :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

The lead developer will see your review and my response to it. Hopefully he can make a decision.

Thanks to your comment, I realized that I needed to clarify that I am just copying an existing code and am not creating code from scratch. So, I appreciate your review.

@DiBochev
Copy link

DiBochev commented Feb 11, 2024

Just an idea to optimize the code:

public static String niceTimeScalarEn2(long t) { // English only - Please do NOT translate
        String unit = "second";
        t = t / 1000;
        if (t > 59) {
            unit = "minute";
            t = t / 60;
            if (t > 59) {
                unit = "hour";
                t = t / 60;
                if (t > 24) {
                    unit = "day";
                    t = t / 24;
                    if (t > 28) {
                        unit = "week";
                        t = t / 7;
                    }
                }
            }
        }
        if (t != 1) unit += "s";
.....

@Navid200
Copy link
Collaborator Author

@jamorham The translation work that translated time units is here: 32a9cba
It was added in 2018.
I doubt that it was done just to translate the time units on the status page.

I didn't want to undo it because it is used everywhere. I don't want to change the time units to English everywhere. I only want to do that on the status page.
So, I copied the code that has all the strings in it and added En to it to reflect English and changed all the string references to English text and I used it only for the status page.

If you want me to do this differently, please tell me. But, parameterizing this will be a lot of work. is it necessary? I will do it if that is the only way.

@Navid200
Copy link
Collaborator Author

@jamorham This takes time:
433438067_10228921122345633_5257209364848274046_n

I would like to help people. But, this is not helping me.
Would you please review this PR?

@Navid200 Navid200 requested a review from jamorham March 24, 2024 15:07
@Navid200
Copy link
Collaborator Author

Navid200 commented Apr 9, 2024

@jamorham The issue this PR will address is really slowing me down as a customer support staff.

Would you please have a look?

@Navid200
Copy link
Collaborator Author

Navid200 commented Apr 9, 2024

If this is unacceptable, which would be a shame because I then wish to know how come we don't translate the logs. I think we don't because you would like to be able to see the logs in English. For the same reason, I need to be able to see the value of last connected in English.

If you accept the intent, but don't like how I have done it, please tell me what you don't like.

If you don't like the intent, can I change the color of the text if it is 5 minutes or greater? But, this will eventually become a mess if one reading a minute some time in the future becomes the norm.
So, I really hope you accept the intent.

@Navid200 Navid200 closed this May 30, 2024
@Navid200 Navid200 deleted the Navid_2024_01_20 branch May 30, 2024 00:35
@Navid200 Navid200 restored the Navid_2024_01_20 branch July 24, 2024 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants