Fixed bug EXT-6842 ([I18N] Date format in Profile - mm/dd/yyyy needs to be: yyyy/mm/dd for Japanese).
- Made avatar registration date localizeable. - Specified localization templates for English, Japanese and German. Reviewed by Mike: https://jira.secondlife.com/browse/EXT-6842 --HG-- branch : product-enginemaster
parent
2e062a8ecb
commit
d88a465a46
|
|
@ -37,6 +37,7 @@
|
|||
// Viewer includes
|
||||
#include "llagent.h"
|
||||
#include "llagentpicksinfo.h"
|
||||
#include "lldateutil.h"
|
||||
#include "llviewergenericmessage.h"
|
||||
|
||||
// Linden library includes
|
||||
|
|
@ -246,6 +247,7 @@ std::string LLAvatarPropertiesProcessor::paymentInfo(const LLAvatarData* avatar_
|
|||
void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* msg, void**)
|
||||
{
|
||||
LLAvatarData avatar_data;
|
||||
std::string birth_date;
|
||||
|
||||
msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AgentID, avatar_data.agent_id);
|
||||
msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AvatarID, avatar_data.avatar_id);
|
||||
|
|
@ -254,11 +256,12 @@ void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem*
|
|||
msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_PartnerID, avatar_data.partner_id);
|
||||
msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_AboutText, avatar_data.about_text);
|
||||
msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_FLAboutText, avatar_data.fl_about_text);
|
||||
msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_BornOn, avatar_data.born_on);
|
||||
msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_BornOn, birth_date);
|
||||
msg->getString( _PREHASH_PropertiesData, _PREHASH_ProfileURL, avatar_data.profile_url);
|
||||
msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_Flags, avatar_data.flags);
|
||||
|
||||
|
||||
LLDateUtil::dateFromPDTString(avatar_data.born_on, birth_date);
|
||||
avatar_data.caption_index = 0;
|
||||
|
||||
S32 charter_member_size = 0;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ struct LLAvatarData
|
|||
LLUUID partner_id;
|
||||
std::string about_text;
|
||||
std::string fl_about_text;
|
||||
std::string born_on;
|
||||
LLDate born_on;
|
||||
std::string profile_url;
|
||||
U8 caption_index;
|
||||
std::string caption_text;
|
||||
|
|
|
|||
|
|
@ -59,19 +59,22 @@ static S32 days_from_month(S32 year, S32 month)
|
|||
}
|
||||
}
|
||||
|
||||
std::string LLDateUtil::ageFromDate(const std::string& date_string,
|
||||
const LLDate& now)
|
||||
bool LLDateUtil::dateFromPDTString(LLDate& date, const std::string& str)
|
||||
{
|
||||
S32 month, day, year;
|
||||
S32 matched = sscanf(str.c_str(), "%d/%d/%d", &month, &day, &year);
|
||||
if (matched != 3) return false;
|
||||
date.fromYMDHMS(year, month, day);
|
||||
F64 secs_since_epoch = date.secondsSinceEpoch();
|
||||
// Correct for the fact that specified date is in Pacific time, == UTC - 8
|
||||
secs_since_epoch += 8.0 * 60.0 * 60.0;
|
||||
date.secondsSinceEpoch(secs_since_epoch);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string LLDateUtil::ageFromDate(const LLDate& born_date, const LLDate& now)
|
||||
{
|
||||
S32 born_month, born_day, born_year;
|
||||
S32 matched = sscanf(date_string.c_str(), "%d/%d/%d", &born_month, &born_day, &born_year);
|
||||
if (matched != 3) return "???";
|
||||
LLDate born_date;
|
||||
born_date.fromYMDHMS(born_year, born_month, born_day);
|
||||
F64 born_date_secs_since_epoch = born_date.secondsSinceEpoch();
|
||||
// Correct for the fact that account creation dates are in Pacific time,
|
||||
// == UTC - 8
|
||||
born_date_secs_since_epoch += 8.0 * 60.0 * 60.0;
|
||||
born_date.secondsSinceEpoch(born_date_secs_since_epoch);
|
||||
// explode out to month/day/year again
|
||||
born_date.split(&born_year, &born_month, &born_day);
|
||||
|
||||
|
|
@ -155,6 +158,16 @@ std::string LLDateUtil::ageFromDate(const std::string& date_string,
|
|||
return LLTrans::getString("TodayOld");
|
||||
}
|
||||
|
||||
std::string LLDateUtil::ageFromDate(const std::string& date_string, const LLDate& now)
|
||||
{
|
||||
LLDate born_date;
|
||||
|
||||
if (!dateFromPDTString(born_date, date_string))
|
||||
return "???";
|
||||
|
||||
return ageFromDate(born_date, now);
|
||||
}
|
||||
|
||||
std::string LLDateUtil::ageFromDate(const std::string& date_string)
|
||||
{
|
||||
return ageFromDate(date_string, LLDate::now());
|
||||
|
|
|
|||
|
|
@ -36,6 +36,29 @@ class LLDate;
|
|||
|
||||
namespace LLDateUtil
|
||||
{
|
||||
/**
|
||||
* Convert a date provided by the server into seconds since the Epoch.
|
||||
*
|
||||
* @param[out] date Number of seconds since 01/01/1970 UTC.
|
||||
* @param[in] str Date string (MM/DD/YYYY) in PDT time zone.
|
||||
*
|
||||
* @return true on success, false on parse error
|
||||
*/
|
||||
bool dateFromPDTString(LLDate& date, const std::string& str);
|
||||
|
||||
/**
|
||||
* Get human-readable avatar age.
|
||||
*
|
||||
* Used for avatar inspectors and profiles.
|
||||
*
|
||||
* @param born_date Date an avatar was born on.
|
||||
* @param now Current date.
|
||||
*
|
||||
* @return human-readable localized string like "1 year, 2 months",
|
||||
* or "???" on error.
|
||||
*/
|
||||
std::string ageFromDate(const LLDate& born_date, const LLDate& now);
|
||||
|
||||
// Convert a date provided by the server (MM/DD/YYYY) into a localized,
|
||||
// human-readable age (1 year, 2 months) using translation strings.
|
||||
// Pass LLDate::now() for now.
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@
|
|||
#include "llfloaterreg.h"
|
||||
#include "llmenubutton.h"
|
||||
#include "lltooltip.h" // positionViewNearMouse()
|
||||
#include "lltrans.h"
|
||||
#include "lluictrl.h"
|
||||
|
||||
#include "llavatariconctrl.h"
|
||||
|
|
@ -380,7 +381,11 @@ void LLInspectAvatar::requestUpdate()
|
|||
void LLInspectAvatar::processAvatarData(LLAvatarData* data)
|
||||
{
|
||||
LLStringUtil::format_map_t args;
|
||||
args["[BORN_ON]"] = data->born_on;
|
||||
{
|
||||
std::string birth_date = LLTrans::getString("AvatarBirthDateFormat");
|
||||
LLStringUtil::format(birth_date, LLSD().with("datetime", (S32) data->born_on.secondsSinceEpoch()));
|
||||
args["[BORN_ON]"] = birth_date;
|
||||
}
|
||||
args["[AGE]"] = LLDateUtil::ageFromDate(data->born_on, LLDate::now());
|
||||
args["[SL_PROFILE]"] = data->about_text;
|
||||
args["[RW_PROFILE"] = data->fl_about_text;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
#include "llnotificationsutil.h"
|
||||
#include "llvoiceclient.h"
|
||||
#include "llnamebox.h"
|
||||
#include "lltrans.h"
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Class LLDropTarget
|
||||
|
|
@ -645,7 +646,11 @@ void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data)
|
|||
LLAvatarIconIDCache::getInstance()->remove(avatar_data->avatar_id);
|
||||
|
||||
LLStringUtil::format_map_t args;
|
||||
args["[REG_DATE]"] = avatar_data->born_on;
|
||||
{
|
||||
std::string birth_date = LLTrans::getString("AvatarBirthDateFormat");
|
||||
LLStringUtil::format(birth_date, LLSD().with("datetime", (S32) avatar_data->born_on.secondsSinceEpoch()));
|
||||
args["[REG_DATE]"] = birth_date;
|
||||
}
|
||||
args["[AGE]"] = LLDateUtil::ageFromDate( avatar_data->born_on, LLDate::now());
|
||||
std::string register_date = getString("RegisterDateFormat", args);
|
||||
childSetValue("register_date", register_date );
|
||||
|
|
|
|||
|
|
@ -3577,4 +3577,7 @@ Missbrauchsbericht
|
|||
<string name="Contents">
|
||||
Inhalt
|
||||
</string>
|
||||
<string name="AvatarBirthDateFormat">
|
||||
[day,datetime,slt]/[mthnum,datetime,slt]/[year,datetime,slt]
|
||||
</string>
|
||||
</strings>
|
||||
|
|
|
|||
|
|
@ -3103,4 +3103,8 @@ Abuse Report</string>
|
|||
<string name="New Script">New Script</string>
|
||||
<string name="New Folder">New Folder</string>
|
||||
<string name="Contents">Contents</string>
|
||||
|
||||
<!-- birth date format shared by avatar inspector and profile panels -->
|
||||
<string name="AvatarBirthDateFormat">[mthnum,datetime,slt]/[day,datetime,slt]/[year,datetime,slt]</string>
|
||||
|
||||
</strings>
|
||||
|
|
|
|||
|
|
@ -3577,4 +3577,7 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
|
|||
<string name="Contents">
|
||||
コンテンツ
|
||||
</string>
|
||||
<string name="AvatarBirthDateFormat">
|
||||
[year,datetime,slt]/[mthnum,datetime,slt]/[day,datetime,slt]
|
||||
</string>
|
||||
</strings>
|
||||
|
|
|
|||
Loading…
Reference in New Issue