summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio/player.c21
-rw-r--r--src/feeds.c31
-rw-r--r--src/ui/documentwidget.c2
-rw-r--r--src/ui/mediaui.c10
4 files changed, 35 insertions, 29 deletions
diff --git a/src/audio/player.c b/src/audio/player.c
index d2ec9870..c08b20fc 100644
--- a/src/audio/player.c
+++ b/src/audio/player.c
@@ -22,6 +22,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22 22
23#include "player.h" 23#include "player.h"
24#include "buf.h" 24#include "buf.h"
25#include "lang.h"
25 26
26#define STB_VORBIS_HEADER_ONLY 27#define STB_VORBIS_HEADER_ONLY
27#include "stb_vorbis.c" 28#include "stb_vorbis.c"
@@ -579,7 +580,7 @@ static iContentSpec contentSpec_Player_(const iPlayer *d) {
579 content.output.freq = info.sample_rate; 580 content.output.freq = info.sample_rate;
580 content.output.channels = numChannels; 581 content.output.channels = numChannels;
581 content.output.format = AUDIO_F32; 582 content.output.format = AUDIO_F32;
582 content.inputFormat = AUDIO_F32; /* actually stb_vorbis provides floats */ 583 content.inputFormat = AUDIO_F32; /* actually stb_vorbis provides floats */
583 stb_vorbis_close(vrb); 584 stb_vorbis_close(vrb);
584 } 585 }
585 else if (content.type == mpeg_DecoderType) { 586 else if (content.type == mpeg_DecoderType) {
@@ -783,23 +784,27 @@ iString *metadataLabel_Player(const iPlayer *d) {
783 lock_Mutex(&d->decoder->tagMutex); 784 lock_Mutex(&d->decoder->tagMutex);
784 const iString *tags = d->decoder->tags; 785 const iString *tags = d->decoder->tags;
785 if (!isEmpty_String(&tags[title_PlayerTag])) { 786 if (!isEmpty_String(&tags[title_PlayerTag])) {
786 appendFormat_String(meta, "Title: %s\n", cstr_String(&tags[title_PlayerTag])); 787 appendFormat_String(meta, "${audio.meta.title}: %s\n", cstr_String(&tags[title_PlayerTag]));
787 } 788 }
788 if (!isEmpty_String(&tags[artist_PlayerTag])) { 789 if (!isEmpty_String(&tags[artist_PlayerTag])) {
789 appendFormat_String(meta, "Artist: %s\n", cstr_String(&tags[artist_PlayerTag])); 790 appendFormat_String(meta, "${audio.meta.artist}: %s\n", cstr_String(&tags[artist_PlayerTag]));
790 } 791 }
791 if (!isEmpty_String(&tags[genre_PlayerTag])) { 792 if (!isEmpty_String(&tags[genre_PlayerTag])) {
792 appendFormat_String(meta, "Genre: %s\n", cstr_String(&tags[genre_PlayerTag])); 793 appendFormat_String(meta, "${audio.meta.genre}: %s\n", cstr_String(&tags[genre_PlayerTag]));
793 } 794 }
794 if (!isEmpty_String(&tags[date_PlayerTag])) { 795 if (!isEmpty_String(&tags[date_PlayerTag])) {
795 appendFormat_String(meta, "Date: %s\n", cstr_String(&tags[date_PlayerTag])); 796 appendFormat_String(meta, "${audio.meta.date}: %s\n", cstr_String(&tags[date_PlayerTag]));
796 } 797 }
797 unlock_Mutex(&d->decoder->tagMutex); 798 unlock_Mutex(&d->decoder->tagMutex);
798 } 799 }
799 if (d->decoder) { 800 if (d->decoder) {
800 appendFormat_String(meta, "%d-bit %s %d Hz", SDL_AUDIO_BITSIZE(d->decoder->inputFormat), 801 appendFormat_String(meta,
801 SDL_AUDIO_ISFLOAT(d->decoder->inputFormat) ? "float" : "integer", 802 translateCStr_Lang("${n.bit} %s %d ${hz}"), /* translation adds %d */
802 d->spec.freq); 803 SDL_AUDIO_BITSIZE(d->decoder->inputFormat),
804 cstr_Lang(SDL_AUDIO_ISFLOAT(d->decoder->inputFormat)
805 ? "numbertype.float"
806 : "numbertype.integer"),
807 d->spec.freq);
803 } 808 }
804 return meta; 809 return meta;
805} 810}
diff --git a/src/feeds.c b/src/feeds.c
index db426994..2f4714f3 100644
--- a/src/feeds.c
+++ b/src/feeds.c
@@ -24,6 +24,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
24#include "bookmarks.h" 24#include "bookmarks.h"
25#include "gmrequest.h" 25#include "gmrequest.h"
26#include "visited.h" 26#include "visited.h"
27#include "lang.h"
27#include "app.h" 28#include "app.h"
28 29
29#include <the_Foundation/file.h> 30#include <the_Foundation/file.h>
@@ -637,30 +638,28 @@ size_t numUnread_Feeds(void) {
637 return count; 638 return count;
638} 639}
639 640
640#define iPluralS(c) ((c) != 1 ? "s" : "")
641
642const iString *entryListPage_Feeds(void) { 641const iString *entryListPage_Feeds(void) {
643 iFeeds *d = &feeds_; 642 iFeeds *d = &feeds_;
644 iString *src = collectNew_String(); 643 iString *src = collectNew_String();
645 format_String(src, "# Feed entries\n\n"); 644 setCStr_String(src, translateCStr_Lang("# ${feeds.list.title}\n\n"));
646 lock_Mutex(d->mtx); 645 lock_Mutex(d->mtx);
647 const iPtrArray *subs = listSubscriptions_(); 646 const iPtrArray *subs = listSubscriptions_();
648 int elapsed = elapsedSeconds_Time(&d->lastRefreshedAt) / 60; 647 const int elapsed = elapsedSeconds_Time(&d->lastRefreshedAt) / 60;
649 appendFormat_String( 648 appendFormat_String(
650 src, 649 src,
651 "You are subscribed to %zu feed%s that contain%s a total of %zu entries.\n", 650 formatCStrs_Lang("feeds.list.counts.n", size_PtrArray(subs)),
652 size_PtrArray(subs), 651 formatCStrs_Lang("feeds.list.entrycount.n", size_SortedArray(&d->entries)));
653 iPluralS(size_PtrArray(subs)),
654 size_PtrArray(subs) == 1 ? "s" : "",
655 size_SortedArray(&d->entries));
656 if (isValid_Time(&d->lastRefreshedAt)) { 652 if (isValid_Time(&d->lastRefreshedAt)) {
657 appendFormat_String(src, 653 if (elapsed == 0) {
658 "\nThe latest refresh occurred %s.\n", 654 appendCStr_String(src, translateCStr_Lang("\n${feeds.list.refreshtime.now}\n"));
659 elapsed == 0 ? "just a moment ago" 655 }
660 : elapsed < 60 ? format_CStr("%d minute%s ago", elapsed, iPluralS(elapsed)) 656 else {
661 : elapsed < 1440 ? format_CStr("%d hour%s ago", elapsed / 60, iPluralS(elapsed / 60)) 657 appendFormat_String(src,
662 : format_CStr("%d day%s ago", elapsed / 1440, 658 translateCStr_Lang("\n${feeds.list.refreshtime}\n"),
663 iPluralS(elapsed / 1440))); 659 elapsed < 60 ? formatCStr_Lang("minutes.ago.n", elapsed)
660 : elapsed < 1440 ? formatCStr_Lang("hours.ago.n", elapsed / 60)
661 : formatCStr_Lang("days.ago.n", elapsed / 1440));
662 }
664 } 663 }
665 iDate on; 664 iDate on;
666 iZap(on); 665 iZap(on);
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index ff89f5ec..e4dadeff 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -3222,7 +3222,7 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) {
3222 draw_Text(metaFont, 3222 draw_Text(metaFont,
3223 topRight_Rect(linkRect), 3223 topRight_Rect(linkRect),
3224 tmInlineContentMetadata_ColorId, 3224 tmInlineContentMetadata_ColorId,
3225 " \u2014 Fetching\u2026 (%.1f MB)", 3225 translateCStr_Lang(" \u2014 ${doc.fetching}\u2026 (%.1f ${mb})"),
3226 (float) bodySize_GmRequest(mr->req) / 1.0e6f); 3226 (float) bodySize_GmRequest(mr->req) / 1.0e6f);
3227 } 3227 }
3228 } 3228 }
diff --git a/src/ui/mediaui.c b/src/ui/mediaui.c
index 2fad0cec..24b29cb0 100644
--- a/src/ui/mediaui.c
+++ b/src/ui/mediaui.c
@@ -27,6 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
27#include "audio/player.h" 27#include "audio/player.h"
28#include "paint.h" 28#include "paint.h"
29#include "util.h" 29#include "util.h"
30#include "lang.h"
30 31
31#include <the_Foundation/path.h> 32#include <the_Foundation/path.h>
32 33
@@ -258,16 +259,17 @@ void draw_DownloadUI(const iDownloadUI *d, iPaint *p) {
258 draw_Text(uiLabel_FontId, 259 draw_Text(uiLabel_FontId,
259 init_I2(x, y2), 260 init_I2(x, y2),
260 isFinished ? uiTextAction_ColorId : uiTextDim_ColorId, 261 isFinished ? uiTextAction_ColorId : uiTextDim_ColorId,
261 isFinished ? "Download completed." 262 cstr_Lang(isFinished ? "media.download.complete" : "media.download.warnclose"));
262 : "Download will be cancelled if this tab is closed.");
263 const int x2 = right_Rect(rect); 263 const int x2 = right_Rect(rect);
264 drawSevenSegmentBytes_(init_I2(x2, y1), uiTextDim_ColorId, info.numBytes); 264 drawSevenSegmentBytes_(init_I2(x2, y1), uiTextDim_ColorId, info.numBytes);
265 const iInt2 pos = init_I2(x2, y2); 265 const iInt2 pos = init_I2(x2, y2);
266 if (bytesPerSecond > 0) { 266 if (bytesPerSecond > 0) {
267 drawAlign_Text(uiLabel_FontId, pos, uiTextDim_ColorId, right_Alignment, "%.3f MB/s", 267 drawAlign_Text(uiLabel_FontId, pos, uiTextDim_ColorId, right_Alignment,
268 translateCStr_Lang("%.3f ${mb.per.sec}"),
268 bytesPerSecond / 1.0e6); 269 bytesPerSecond / 1.0e6);
269 } 270 }
270 else { 271 else {
271 drawAlign_Text(uiLabel_FontId, pos, uiTextDim_ColorId, right_Alignment, "\u2014 MB/s"); 272 drawAlign_Text(uiLabel_FontId, pos, uiTextDim_ColorId, right_Alignment,
273 translateCStr_Lang("\u2014 ${mb.per.sec}"));
272 } 274 }
273} 275}