forked from mastodon/mastodon
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #858 from kmycode/upstream-20241001
Upstream 20241001
- Loading branch information
Showing
222 changed files
with
1,834 additions
and
720 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Crowdin / Download translations (stable branches) | ||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
download-translations-stable: | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'mastodon/mastodon' | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Increase Git http.postBuffer | ||
# This is needed due to a bug in Ubuntu's cURL version? | ||
# See https://github.com/orgs/community/discussions/55820 | ||
run: | | ||
git config --global http.version HTTP/1.1 | ||
git config --global http.postBuffer 157286400 | ||
# Download the translation files from Crowdin | ||
- name: crowdin action | ||
uses: crowdin/github-action@v2 | ||
with: | ||
upload_sources: false | ||
upload_translations: false | ||
download_translations: true | ||
crowdin_branch_name: ${{ github.base_ref || github.ref_name }} | ||
push_translations: false | ||
create_pull_request: false | ||
env: | ||
CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }} | ||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | ||
|
||
# As the files are extracted from a Docker container, they belong to root:root | ||
# We need to fix this before the next steps | ||
- name: Fix file permissions | ||
run: sudo chown -R runner:docker . | ||
|
||
# This is needed to run the normalize step | ||
- name: Set up Ruby environment | ||
uses: ./.github/actions/setup-ruby | ||
|
||
- name: Run i18n normalize task | ||
run: bundle exec i18n-tasks normalize | ||
|
||
# Create or update the pull request | ||
- name: Create Pull Request | ||
uses: peter-evans/[email protected] | ||
with: | ||
commit-message: 'New Crowdin translations' | ||
title: 'New Crowdin Translations for ${{ github.base_ref || github.ref_name }} (automated)' | ||
author: 'GitHub Actions <[email protected]>' | ||
body: | | ||
New Crowdin translations, automated with GitHub Actions | ||
See `.github/workflows/crowdin-download.yml` | ||
This PR will be updated every day with new translations. | ||
Due to a limitation in GitHub Actions, checks are not running on this PR without manual action. | ||
If you want to run the checks, then close and re-open it. | ||
branch: i18n/crowdin/translations-${{ github.base_ref || github.ref_name }} | ||
base: ${{ github.base_ref || github.ref_name }} | ||
labels: i18n |
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { useState, useCallback, useRef } from 'react'; | ||
|
||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import Overlay from 'react-overlays/Overlay'; | ||
import type { | ||
OffsetValue, | ||
UsePopperOptions, | ||
} from 'react-overlays/esm/usePopper'; | ||
|
||
const offset = [0, 4] as OffsetValue; | ||
const popperConfig = { strategy: 'fixed' } as UsePopperOptions; | ||
|
||
export const AltTextBadge: React.FC<{ | ||
description: string; | ||
}> = ({ description }) => { | ||
const anchorRef = useRef<HTMLButtonElement>(null); | ||
const [open, setOpen] = useState(false); | ||
|
||
const handleClick = useCallback(() => { | ||
setOpen((v) => !v); | ||
}, [setOpen]); | ||
|
||
const handleClose = useCallback(() => { | ||
setOpen(false); | ||
}, [setOpen]); | ||
|
||
return ( | ||
<> | ||
<button | ||
ref={anchorRef} | ||
className='media-gallery__alt__label' | ||
onClick={handleClick} | ||
> | ||
ALT | ||
</button> | ||
|
||
<Overlay | ||
rootClose | ||
onHide={handleClose} | ||
show={open} | ||
target={anchorRef.current} | ||
placement='top-end' | ||
flip | ||
offset={offset} | ||
popperConfig={popperConfig} | ||
> | ||
{({ props }) => ( | ||
<div {...props} className='hover-card-controller'> | ||
<div | ||
className='media-gallery__alt__popover dropdown-animation' | ||
role='tooltip' | ||
> | ||
<h4> | ||
<FormattedMessage | ||
id='alt_text_badge.title' | ||
defaultMessage='Alt text' | ||
/> | ||
</h4> | ||
<p>{description}</p> | ||
</div> | ||
</div> | ||
)} | ||
</Overlay> | ||
</> | ||
); | ||
}; |
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.