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
I18n: Translate phrases for new Browse Dashboards #70654
Merged
RoxanaAnamariaTurc
merged 11 commits into
grafana:main
from
Bohdanator:70085-i18n-for-managing-dashboards
Jul 4, 2023
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
84d152f
Mark strings in folder manager nav for translation
Bohdanator 947fffb
Mark strings in folder actions for translation
Bohdanator 61a4ead
Mark strings in new folder modal for translation
Bohdanator 920619c
Mark strings in delete modal for translation
Bohdanator c8b2960
Mark strings in move modal for translation
Bohdanator 10ba1e4
Fix interpunction in translations
Bohdanator a682ee2
Run i18n:extract
Bohdanator 68cd489
Fix Manage Permissions drawer test
Bohdanator 8624b14
Redundnt useMemo
Bohdanator 75e900e
Merge branch 'main' into 70085-i18n-for-managing-dashboards
a0c689a
Updated extracted translations after resolving conflicts
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import React, { useState } from 'react'; | ||
import React, { useState, useMemo } from 'react'; | ||
|
||
import { Space } from '@grafana/experimental'; | ||
import { Alert, Button, Field, Modal } from '@grafana/ui'; | ||
import { P } from '@grafana/ui/src/unstable'; | ||
import { FolderPicker } from 'app/core/components/Select/FolderPicker'; | ||
import { t, Trans } from 'app/core/internationalization'; | ||
|
||
import { DashboardTreeSelection } from '../../types'; | ||
|
||
|
@@ -19,6 +20,11 @@ export interface Props { | |
export const MoveModal = ({ onConfirm, onDismiss, selectedItems, ...props }: Props) => { | ||
const [moveTarget, setMoveTarget] = useState<string>(); | ||
const [isMoving, setIsMoving] = useState(false); | ||
const moveButtonText = useMemo( | ||
() => | ||
isMoving ? t('browse-dashboards.action.moving', 'Moving...') : t('browse-dashboards.action.move-button', 'Move'), | ||
[isMoving] | ||
); | ||
const selectedFolders = Object.keys(selectedItems.folder).filter((uid) => selectedItems.folder[uid]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above comment about useMemo hook. |
||
|
||
const onMove = async () => { | ||
|
@@ -35,25 +41,32 @@ export const MoveModal = ({ onConfirm, onDismiss, selectedItems, ...props }: Pro | |
}; | ||
|
||
return ( | ||
<Modal title="Move" onDismiss={onDismiss} {...props}> | ||
{selectedFolders.length > 0 && <Alert severity="info" title="Moving this item may change its permissions." />} | ||
<Modal title={t('browse-dashboards.action.move-modal-title', 'Move')} onDismiss={onDismiss} {...props}> | ||
{selectedFolders.length > 0 && ( | ||
<Alert | ||
severity="info" | ||
title={t('browse-dashboards.action.move-modal-alert', 'Moving this item may change its permissions.')} | ||
/> | ||
)} | ||
|
||
<P>This action will move the following content:</P> | ||
<P> | ||
<Trans i18nKey="browse-dashboards.action.move-modal-text">This action will move the following content:</Trans> | ||
</P> | ||
|
||
<DescendantCount selectedItems={selectedItems} /> | ||
|
||
<Space v={3} /> | ||
|
||
<Field label="Folder name"> | ||
<Field label={t('browse-dashboards.action.move-modal-field-label', 'Folder name')}> | ||
<FolderPicker allowEmpty onChange={({ uid }) => setMoveTarget(uid)} /> | ||
</Field> | ||
|
||
<Modal.ButtonRow> | ||
<Button onClick={onDismiss} variant="secondary" fill="outline"> | ||
Cancel | ||
<Trans i18nKey="browse-dashboards.action.cancel-button">Cancel</Trans> | ||
</Button> | ||
<Button disabled={moveTarget === undefined || isMoving} onClick={onMove} variant="primary"> | ||
{isMoving ? 'Moving...' : 'Move'} | ||
{moveButtonText} | ||
</Button> | ||
</Modal.ButtonRow> | ||
</Modal> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the useMemo hook is necessary in this case, you can just use the t() function inside the ternary directly