ADD: MacCloud/i18n: step-132: enable i18n in project

This commit is contained in:
rich2014 2025-05-18 14:34:14 +08:00
commit aa410f0ce6
6 changed files with 89 additions and 40 deletions

View file

@ -13,6 +13,10 @@
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<i18n>
<EnableI18N Value="True" LFM="False"/>
<OutDir Value="../language"/>
</i18n>
<BuildModes>
<Item Name="Default" Default="True"/>
</BuildModes>
@ -173,6 +177,11 @@
<IsPartOfProject Value="True"/>
<UnitName Value="uHuaweiOBSClient"/>
</Unit>
<Unit>
<Filename Value="wfx/ui/uwfxoptionscommonrs.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uWFXOptionsCommonRS"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>

View file

@ -0,0 +1,18 @@
unit uWFXOptionsCommonRS;
{$mode ObjFPC}{$H+}
interface
resourcestring
rsNameLabel = 'Name:';
rsOkButtonTitle = 'OK';
rsCancelButtonTitle = 'Cancel';
rsSaveButtonTitle = 'Save';
rsConnectButtonTitle = 'Connect';
rsDisconnectButtonTitle = 'Disconnect';
implementation
end.

View file

@ -9,7 +9,7 @@ uses
Classes, SysUtils,
CocoaAll, uMiniCocoa,
uCloudDriver, uWFXPlugin, uWFXUtil,
uWFXOptionsCore,
uWFXOptionsCore, uWFXOptionsCommonRS,
uMiniUtil;
type
@ -32,12 +32,12 @@ type
implementation
const
CONST_AUTH_NOTES =
'1. Before successfully enabling the connection, Double Command needs to obtain authorization from {driverName}'#13#13 +
resourcestring
rsAuthNotes =
'1. Before successfully enabling the connection, Double Commander needs to obtain authorization from {driverName}'#13#13 +
'2. Click the connect button to be redirected to the {driverName} official website in the Safari browser'#13#13 +
'3. Please login your {driverName} account in Safari and authorize Double Commander to access'#13#13 +
'4. The authorization is completed on the {driverName} official website, Double Command will not get your password';
'4. The authorization is completed on the {driverName} official website, Double Commander will not get your password';
{ TWFXOAuth2PropertyView }
@ -63,14 +63,14 @@ begin
configItem:= _controller.currentConfigItem;
if configItem.driver.authorized then begin
statusImageName:= NSImageNameStatusAvailable;
connectButtonText:= 'Disconnect';
connectButtonText:= rsDisconnectButtonTitle;
end else begin
statusImageName:= NSImageNameStatusUnavailable;
connectButtonText:= 'Connect';
connectButtonText:= rsConnectButtonTitle;
end;
_statusImageview.setImage( NSImage.imageNamed(statusImageName) );
_connectButton.setTitle( StringToNSString(connectButtonText) );
notes:= CONST_AUTH_NOTES.Replace( '{driverName}', configItem.driver.driverName );
notes:= rsAuthNotes.Replace( '{driverName}', configItem.driver.driverName );
_noteTextView.setString( StringToNSString(notes) );
end;
@ -115,7 +115,7 @@ begin
self.addSubview( _logoImageView );
_logoImageView.release;
addLabel( StringToNSString('Name:'), NSMakeRect(20,510,80,20) );
addLabel( StringToNSString(rsNameLabel), NSMakeRect(20,510,80,20) );
_nameTextField:= addTextField( NSMakeRect(106,510,290,22) );
_statusImageview:= NSImageView.alloc.initWithFrame( NSMakeRect(406,513,16,16) );
@ -131,7 +131,7 @@ begin
_saveButton:= NSButton.alloc.initWithFrame( NSMakeRect(260,440,120,22) );
_saveButton.setBezelStyle( NSRoundedBezelStyle );
_saveButton.setTitle( StringToNSString('Save') );
_saveButton.setTitle( StringToNSString(rsSaveButtonTitle) );
_saveButton.setTarget( self );
_saveButton.setAction( ObjCSelector('TWFXOAuth2PropertyView_saveConnection:') );
self.addSubView( _saveButton );

View file

@ -9,7 +9,8 @@ uses
Classes, SysUtils,
CocoaAll, uMiniCocoa,
uAWSCore, uS3Client,
uWFXPlugin, uWFXUtil, uWFXOptionsCore,
uWFXPlugin, uWFXUtil,
uWFXOptionsCore, uWFXOptionsCommonRS,
uMiniUtil;
type
@ -74,8 +75,18 @@ type
implementation
const
CONST_AUTH_NOTES =
resourcestring
rsAccessKeyIDLabel = 'Access Key ID:';
rsSecretAccessKeyLabel = 'Secret Access Key:';
rsTemporaryTokenLabel = 'Temporary Token:';
rsRegionListLabel = 'Region List:';
rsRegionLabel = 'Region:';
rsBucketLabel = 'Bucket:';
rsEndpointLabel = 'Endpoint:';
rsRegionUserCustom = '(User Custom)';
rsParamsAlertTitle = 'Incomplete Parameters';
rsParamsAlertText = 'Access Key ID and Secret Access Key are required, please make sure they are correct. If permissions are insufficient or you are setting "S3 Compatible", Region / Endpoint / Bucket is also required.';
rsAuthNotes =
'1. AccessKeyID and SerectAccessKey will be saved in the macOS KeyChains to obtain system-level security. The confidential data can only be read by your own macOS permissions.'#13#13 +
'2. Access Key ID and Secret Access Key are required, and the others are optional. Double Commander can usually automatically obtain others such as Buckets. Therefore, Region / EndPoint / Bucket are only required if Access Key permissions are insufficient.';
@ -210,7 +221,7 @@ begin
Exit;
client:= TAWSCloudDriver( configItem.driver );
_regionDropDown.addItemWithTitle( StringToNSString('(User Custom)') );
_regionDropDown.addItemWithTitle( StringToNSString(rsRegionUserCustom) );
self.loadRegionItems( client );
if _regionDropDown.itemArray.count = 1 then
_regionDropDown.setEnabled( False );
@ -252,9 +263,9 @@ var
end;
alert:= NSAlert.new;
alert.setMessageText( StringToNSString('Incomplete Parameters') );
alert.setInformativeText( StringToNSString('Access Key ID and Secret Access Key are required, please make sure they are correct. If permissions are insufficient or you are setting "S3 Compatible", Region / Endpoint / Bucket is also required.') );
alert.addButtonWithTitle( StringToNSString('OK') );
alert.setMessageText( StringToNSString(rsParamsAlertTitle) );
alert.setInformativeText( StringToNSString(rsParamsAlertText) );
alert.addButtonWithTitle( StringToNSString(rsOkButtonTitle) );
alert.runModal;
alert.release;
end;
@ -291,13 +302,13 @@ begin
self.addSubview( _logoImageView );
_logoImageView.release;
addLabel( StringToNSString('Name:'), NSMakeRect(20,510,120,20) );
addLabel( StringToNSString(rsNameLabel), NSMakeRect(20,510,120,20) );
_nameTextField:= addTextField( NSMakeRect(146,510,290,22) );
addLabel( StringToNSString('Access Key ID:'), NSMakeRect(20,470,120,20) );
addLabel( StringToNSString(rsAccessKeyIDLabel), NSMakeRect(20,470,120,20) );
_accessKeyIDTextField:= addTextField( NSMakeRect(146,470,290,22) );
addLabel( StringToNSString('Serect Access Key:'), NSMakeRect(20,430,120,20) );
addLabel( StringToNSString(rsSecretAccessKeyLabel), NSMakeRect(20,430,120,20) );
_accessKeySecretTextField:= NSSecureTextField.alloc.initWithFrame( NSMakeRect(146,430,290,22) );
_accessKeySecretTextField.cell.setScrollable( True );
_accessKeySecretTextField.cell.setWraps( False );
@ -315,28 +326,28 @@ begin
self.addSubview( _secretButton );
_secretButton.release;
addLabel( StringToNSString('Temporary Token:'), NSMakeRect(20,390,120,20) );
addLabel( StringToNSString(rsTemporaryTokenLabel), NSMakeRect(20,390,120,20) );
_accessKeyTokenTextField:= addTextField( NSMakeRect(146,390,290,22) );
addLabel( StringToNSString('Region List:'), NSMakeRect(20,350,120,20) );
addLabel( StringToNSString(rsRegionListLabel), NSMakeRect(20,350,120,20) );
_regionDropDown:= NSPopUpButton.alloc.initWithFrame( NSMakeRect(146,350,290,22) );
_regionDropDown.setTarget( self );
_regionDropDown.setAction( ObjCSelector('TWFXS3PropertyView_regionDropDownChanged:') );
self.addSubview( _regionDropDown );
_regionDropDown.release;
addLabel( StringToNSString('Region:'), NSMakeRect(20,310,120,20) );
addLabel( StringToNSString(rsRegionLabel), NSMakeRect(20,310,120,20) );
_regionTextField:= addTextField( NSMakeRect(146,310,290,22) );
addLabel( StringToNSString('Endpoint:'), NSMakeRect(20,270,120,20) );
addLabel( StringToNSString(rsEndpointLabel), NSMakeRect(20,270,120,20) );
_endPointTextField:= addTextField( NSMakeRect(146,270,290,22) );
addLabel( StringToNSString('Bucket:'), NSMakeRect(20,230,120,20) );
addLabel( StringToNSString(rsBucketLabel), NSMakeRect(20,230,120,20) );
_bucketTextField:= addTextField( NSMakeRect(146,230,290,22) );
_saveButton:= NSButton.alloc.initWithFrame( NSMakeRect(190,190,100,22) );
_saveButton.setBezelStyle( NSRoundedBezelStyle );
_saveButton.setTitle( StringToNSString('Save') );
_saveButton.setTitle( StringToNSString(rsSaveButtonTitle) );
_saveButton.setTarget( self );
_saveButton.setAction( ObjCSelector('TWFXS3PropertyView_saveConnection:') );
self.addSubView( _saveButton );
@ -346,7 +357,7 @@ begin
_noteTextView.setFont( NSFont.systemFontOfSize(11));
_noteTextView.setEditable( False );
_noteTextView.setDrawsBackground( False );
_noteTextView.setString( StringToNSString(CONST_AUTH_NOTES) );
_noteTextView.setString( StringToNSString(rsAuthNotes) );
self.addSubView( _noteTextView );
_noteTextView.release;
end;

View file

@ -10,7 +10,7 @@ uses
CocoaAll, uMiniCocoa,
uCloudDriver, uOAuth2Client,
uWFXPlugin, uWFXUtil,
uWFXOptionsCore, uWFXOptionsOAuth2, uWFXOptionsS3,
uWFXOptionsCore, uWFXOptionsCommonRS, uWFXOptionsOAuth2, uWFXOptionsS3,
uMiniUtil;
type
@ -165,7 +165,7 @@ begin
frameRect:= NSMakeRect( 105, 25, 80, 22 );
cancelButton:= NSButton.alloc.initWithFrame( frameRect );
cancelButton.setTitle( StringToNSString('Cancel') );
cancelButton.setTitle( StringToNSString(rsCancelButtonTitle) );
cancelButton.setButtonType( NSMomentaryPushInButton );
cancelButton.setBezelStyle( NSRoundedBezelStyle );
cancelButton.setKeyEquivalent( NSSTR(#27) );
@ -176,7 +176,7 @@ begin
frameRect:= NSMakeRect( 200, 25, 80, 22 );
okButton:= NSButton.alloc.initWithFrame( frameRect );
okButton.setTitle( StringToNSString('OK') );
okButton.setTitle( StringToNSString(rsOkButtonTitle) );
okButton.setButtonType( NSMomentaryPushInButton );
okButton.setBezelStyle( NSRoundedBezelStyle );
okButton.setKeyEquivalent( NSSTR(#13) );
@ -323,7 +323,7 @@ var
alert:= NSAlert.new;
alert.setMessageText( StringToNSString('Duplicate Name') );
alert.setInformativeText( StringToNSString('Please rename the Connection before saving.') );
alert.addButtonWithTitle( StringToNSString('OK') );
alert.addButtonWithTitle( StringToNSString(rsOkButtonTitle) );
alert.runModal;
alert.release;
end;

View file

@ -55,6 +55,17 @@ var
implementation
resourcestring
rsDropBoxDisplayName = 'DropBox';
rsYandexDisplayName = 'Yandex';
rsOneDriveDisplayName = 'OneDrive';
rsBoxDisplayName = 'Box';
rsAmazonS3DisplayName = 'Amazon S3';
rsS3CompatibleDisplayName = 'S3 Compatible';
rsAliyunOSSDisplayName = 'Alibaba Cloud OSS';
rsTencentCOSDisplayName = 'Tencent Cloud COS';
rsHuaweiOBSDisplayName = 'Huawei Cloud OBS';
type
{ TWFXTokenCloudDriverConfig }
@ -522,46 +533,46 @@ begin
WFXCloudDriverConfigManager.register( TDropBoxClient.driverName, TWFXDropBoxConfig );
dropBoxConfig:= TTokenCloudDriverConfig.Create( 'ahj0s9xia6i61gh', 'dc2ea085a05ac273a://dropbox/auth' );
cloudDriverManager.register( TDropBoxClient );
WFXCloudDriverMenuItems.add( TDropBoxClient.driverName, 'DropBox' );
WFXCloudDriverMenuItems.add( TDropBoxClient.driverName, rsDropBoxDisplayName );
WFXCloudDriverConfigManager.register( TYandexClient.driverName, TWFXYandexConfig );
yandexConfig:= TTokenCloudDriverConfig.Create( 'eaf0c133568a46a0bd986bffb48c62b6', 'dc2ea085a05ac273a://yandex/auth' );
cloudDriverManager.register( TYandexClient );
WFXCloudDriverMenuItems.add( TYandexClient.driverName, 'Yandex' );
WFXCloudDriverMenuItems.add( TYandexClient.driverName, rsYandexDisplayName );
WFXCloudDriverConfigManager.register( TOneDriveClient.driverName, TWFXOneDriveConfig );
oneDriveConfig:= TTokenCloudDriverConfig.Create( 'ceb7b2ed-b0cf-43e9-ade5-2e8ed9cfa3c0', 'dc2ea085a05ac273a://onedrive/auth' );
cloudDriverManager.register( TOneDriveClient );
WFXCloudDriverMenuItems.add( TOneDriveClient.driverName, 'OneDrive' );
WFXCloudDriverMenuItems.add( TOneDriveClient.driverName, rsOneDriveDisplayName );
WFXCloudDriverConfigManager.register( TBoxClient.driverName, TWFXBoxConfig );
boxConfig:= TTokenCloudDriverConfig.Create( 'rtm1apih0scrk1we9dnzej7fezd9t2xb', 'dc2ea085a05ac273a://box/auth' );
cloudDriverManager.register( TBoxClient );
WFXCloudDriverMenuItems.add( TBoxClient.driverName, 'Box' );
WFXCloudDriverMenuItems.add( TBoxClient.driverName, rsBoxDisplayName );
WFXCloudDriverMenuItems.addSeparator;
WFXCloudDriverConfigManager.register( TAmazonS3Client.driverName, TWFXS3Config );
cloudDriverManager.register( TAmazonS3Client );
WFXCloudDriverMenuItems.add( TAmazonS3Client.driverName, 'Amazon S3' );
WFXCloudDriverMenuItems.add( TAmazonS3Client.driverName, rsAmazonS3DisplayName );
WFXCloudDriverConfigManager.register( TS3CompatibleClient.driverName, TWFXS3Config );
cloudDriverManager.register( TS3CompatibleClient );
WFXCloudDriverMenuItems.add( TS3CompatibleClient.driverName, 'S3 Compatible' );
WFXCloudDriverMenuItems.add( TS3CompatibleClient.driverName, rsS3CompatibleDisplayName );
WFXCloudDriverMenuItems.addSeparator;
WFXCloudDriverConfigManager.register( TAliyunOSSClient.driverName, TWFXS3Config );
cloudDriverManager.register( TAliyunOSSClient );
WFXCloudDriverMenuItems.add( TAliyunOSSClient.driverName, 'Alibaba Cloud OSS' );
WFXCloudDriverMenuItems.add( TAliyunOSSClient.driverName, rsAliyunOSSDisplayName );
WFXCloudDriverConfigManager.register( TTencentCOSClient.driverName, TWFXS3Config );
cloudDriverManager.register( TTencentCOSClient );
WFXCloudDriverMenuItems.add( TTencentCOSClient.driverName, 'Tencent Cloud COS' );
WFXCloudDriverMenuItems.add( TTencentCOSClient.driverName, rsTencentCOSDisplayName );
WFXCloudDriverConfigManager.register( THuaweiOBSClient.driverName, TWFXS3Config );
cloudDriverManager.register( THuaweiOBSClient );
WFXCloudDriverMenuItems.add( THuaweiOBSClient.driverName, 'Huawei Cloud OBS' );
WFXCloudDriverMenuItems.add( THuaweiOBSClient.driverName, rsHuaweiOBSDisplayName );
end;
initialization