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

Improve weekdays translations #43

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion js/base/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ if (typeof(window?.warpGlobals?.i18n) !== 'object')

let locale = window.warpGlobals.i18n.locale;
let phrases = window.warpGlobals.i18n.phrases;
let weekdaysShort = window.warpGlobals.i18n.weekdaysShort;

if (!locale || !phrases)
throw Error('locale and phrases must be defined');

window.warpGlobals.i18n.polyglot = new Polyglot({
locale: locale,
phrases: phrases
phrases: { ...phrases, weekdaysShort }
})

window.TR = window.warpGlobals.i18n.polyglot.t.bind(window.warpGlobals.i18n.polyglot);
Expand Down
3 changes: 2 additions & 1 deletion js/views/bookings.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ document.addEventListener("DOMContentLoaded", function(e) {
var toTS = new Date(parseInt(data.toTS)*1000);

var res =
fromTS.toUTCString().substring(0,5)+
TR(`weekdaysShort.${fromTS.getDay()}`)+
', '+
fromTS.toISOString().substring(0,16).replace('T',' ')+
'-'+
toTS.toISOString().substring(11,16);
Expand Down
3 changes: 1 addition & 2 deletions warp/templates/zone.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ <h4 id="assigned_seat_header"></h4>
<label>
<input class="filled-in date_checkbox" type="checkbox" value="{{w['timestamp']}}" />
<span>
{# TODO_TR quite ugly #}
<script>document.write(warpGlobals.i18n.weekdaysShort[{{ w['weekdayN'] }}]); </script>, {{ w['date'] }}
<span class="TR">weekdaysShort.{{ w['weekdayN'] }}</span>, {{ w['date'] }}
</span>
</label>
</p>
Expand Down