Merge lp:~wingpanel-devs/wingpanel-indicator-datetime/weekday_uppercase into lp:~wingpanel-devs/wingpanel-indicator-datetime/trunk

Proposed by Djax
Status: Merged
Approved by: Zisu Andrei
Approved revision: 103
Merged at revision: 164
Proposed branch: lp:~wingpanel-devs/wingpanel-indicator-datetime/weekday_uppercase
Merge into: lp:~wingpanel-devs/wingpanel-indicator-datetime/trunk
Diff against target: 15 lines (+4/-1)
1 file modified
src/Indicator.vala (+4/-1)
To merge this branch: bzr merge lp:~wingpanel-devs/wingpanel-indicator-datetime/weekday_uppercase
Reviewer Review Type Date Requested Status
Zisu Andrei (community) Approve
kay van der Zander Needs Information
Review via email: mp+285941@code.launchpad.net

Commit message

ensure that the first letter of the weekday on the top is always upper case

Description of the change

In some languages e.g. french the first letter of the week day is not in upper case. This makes sure that the weekday on the top starts with a upper case letter.

To post a comment you must log in.
Revision history for this message
kay van der Zander (kay20) wrote :

Just a question why aren't you using the up and down functions of string in glib?

If you want to have al characters lowercase then use down function is way shorter then convert one char into lowercase.

As far as i understand what you are achieving is "Monday" into "monday" right?

review: Needs Information
Revision history for this message
Djax (parnold-x) wrote :

Nope, like the description says.
It does "monday" to "Monday"

Revision history for this message
kay van der Zander (kay20) wrote :

String format = formated_weekday.get_char(0).totitle/toupper().to_string();
format += fomated_weekday.substring (1, -1);

How about this way? Filling the string from right to left.

Revision history for this message
Zisu Andrei (matzipan) wrote :

I do not see any regressions.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Indicator.vala'
2--- src/Indicator.vala 2016-02-06 17:07:46 +0000
3+++ src/Indicator.vala 2016-02-12 21:18:14 +0000
4@@ -137,7 +137,10 @@
5 }
6
7 private void update_today_button () {
8- weekday_label.set_label (Services.TimeManager.get_default ().format ("%A"));
9+ string formated_weekday = Services.TimeManager.get_default ().format ("%A");
10+ string new_value = formated_weekday.substring (formated_weekday.index_of_nth_char (1));
11+ new_value = formated_weekday.get_char (0).totitle ().to_string () + new_value;
12+ weekday_label.set_label (new_value);
13 /* TRANSLATORS: Date format in the popover excluding the weekday; following http://valadoc.org/#!api=glib-2.0/GLib.DateTime.format */
14 date_label.set_label (Services.TimeManager.get_default ().format (_("%B %e, %Y")));
15 }

Subscribers

People subscribed via source and target branches