rejetto forum

next default template to build 261

rejetto · 84 · 20786

0 Members and 1 Guest are viewing this topic.

Offline Nestor

  • Occasional poster
  • *
    • Posts: 4
    • View Profile
As I mentioned, this is not a problem for Spanish, I was only concerned about localization for other languages.
AFAIK, it's generally accepted by programmers that hardcoding strings makes localization more difficult, so it's not a good practice.

This is constructive criticism, I do appreciate the time and effort spent in this useful application, that's why I posted.
« Last Edit: June 27, 2010, 12:34:59 PM by Nestor »


Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1297
  • ....... chut ! shh!
    • View Profile
I agree with you.
Before we can use external languages files for HFS, it will must review some strings ... The B is not the most difficult to overcome, however.
« Last Edit: June 27, 2010, 12:57:13 PM by SilentPliz »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13307
    • View Profile

Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2008
    • View Profile
i think it is possible to change to

%total-size% return the unit  without 'B'  , in the same time we can modify  %item-size%

the delphi function must return only the value and the unit without the 'B'

Quote
function smartsize(size:int64):string;
begin
if size < 0 then result:='N/A'
else
  if size < 1 shl 10 then result:=format('%d ',[size])
  else
    if size < 1 shl 20 then result:=format('%f K',[size/(1 shl 10)])
    else
      if size < 1 shl 30 then result:=format('%f M',[size/(1 shl 20)])
      else result:=format('%f G',[size/(1 shl 30)])
end; // smartsize

<div id='folder-stats'>%number-folders% {.!folders.},  %number-files% {.!files.}, %total-size%{.!unit.}

then in the template it will possible to use as unit one of

[special:string]
unit=Byte
unit=Octet
unit=Octeto
unit=Байт
unit=バイト
unit=字节
unit=בייט

for other values we can change the template or the delphi code
vars:
'%total-out%' '%total-in%' '%total-size%'
'%diskfree%' '%item-size%' '%done%' '%total%'

macros:
'smart size'


others: 6 update

HRM_REPLY: if not data.fullDLlogged then add2log(format('Served %sB', [smartSize(conn.bytesSentLastItem)]), data);
HE_POST_END_FILE:
  if logUploadsChk.checked and (data.uploadFailed = '') then
    add2log(format('Fully uploaded -  %sB @ %d KB/s', [
      smartSize(conn.bytesPostedLastItem),
      calcAverageSpeed(conn.bytesPostedLastItem) ]), data);
HE_LAST_BYTE_DONE:
  if logFulldownloadsChk.checked
  and (data.downloadingWhat in [DW_FILE, DW_ARCHIVE]) then
    begin
    data.fullDLlogged:=TRUE;
    add2log(format('Fully downloaded - %sB @ %d KB/s - %s', [
      smartSize(conn.bytesSentLastItem),
      calcAverageSpeed(conn.bytesSentLastItem), url_]), data);
    end;

  sbarIdxs.totalOut:=addPanel( format('Total Out: %sB',[
    smartSize(outTotalOfs+srv.bytesSent)]) );
  sbarIdxs.totalIn:=addPanel( format('Total In: %sB',[
    smartSize(inTotalOfs+srv.bytesReceived)]) );

  if f.isFile() then
    result:=result+format(#13'Size: %s'#13'Downloads: %dB',
      [ smartsize(sizeofFile(f.resource)), f.DLcount ]);


in the template: 4 update
<div id='folder-stats'>%number-folders% {.!folders.},  %number-files% {.!files.}, %total-size%{.!unit.}

[+file]
<td>%item-size%{.!unit.}<td>%item-modified%<td>%item-dl-count%


[progress-upload-file]
{.if not|{.{.?only.} = down.}|{:
   <li> Uploading %total%{.!unit.} @ %speed-kb% KB/s
   <br /><span class='fn'>%filename%</span>

[progress-download-file]
{.if not|{.{.?only.} = up.}|{:
   <li> Downloading %total%{.!unit.}
   <br>Speed: %speed-kb% KB/s


now it's time to apply all of them to the build 261. ;)


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13307
    • View Profile
i think we can live without the B in some of the places where it used to be there


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2008
    • View Profile
Quote
i think we can live without the B in some of the places where it used to be there

The "B" in the template will miss us less than you on the forum, even if it means going without something, for me, it will be the "B".

Do I have to set up a pool for this question? :D :D :D :D
 ;)


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1934
    • View Profile
    • RAWR-Designs
I was thinking, if you want to include a HFS logo or something, so it doesn't look like its coming from purple land, and you don't want to host it on the server as an image, or embed it in the application.

You could use a base64 uri in css, this lets a user delete it for modification, it also is not actually hidden in HFS and used only for template purposes, keeps it editable. You could use this to add images to the interface also, if you wanted to make a really pro default template.

This does pose some problems, make sure you comment what it is, otherwise it just looks like a block of letters. It also does increase the CSS size, obviously, so make sure any base64 operations are at the bottom of the CSS file, so its the last thing to happen after the page generation. You can also do this to reduce the number of calls to the server. I don't like it from a designers point of view, I like to see the images on my hard drive, and I use sprites to get around the multiple call issue. But it is handy sometimes.

Something like this could also be used with the HFS icons, you could convert the windows icons to png24 then base64 them and feed that to the browser. If this isn't already how it works, I am not sure. Just trying to help, when I can.

A related article:
http://www.nczonline.net/blog/2010/07/06/data-uris-make-css-sprites-obsolete/

A base64 online encoder/decoder:
http://www.motobit.com/util/base64-decoder-encoder.asp

« Last Edit: July 08, 2010, 10:51:05 AM by TSG »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13307
    • View Profile
interesting, it may be used for small images, like single pixel width gradients.
things like that should be like 1kb or so.


Phillip

  • Guest
I tested it and it looks good.  I like the format, simple and to the point.