-
Notifications
You must be signed in to change notification settings - Fork 0
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 #276 from Vizzuality/SKY30-375-support-language-tr…
…anslation-for-english-french-spanish Push and pull translations from Localazy, language selector
- Loading branch information
Showing
16 changed files
with
213 additions
and
21 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,20 @@ | ||
name: Release tag on Localazy | ||
on: | ||
push: | ||
workflow_dispatch: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
localazy-release: | ||
name: Release strings to production on Localazy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: localazy/tag@v1 | ||
with: | ||
workdir: 'frontend' | ||
read_key: ${{ secrets.LOCALAZY_READ_KEY }} | ||
write_key: ${{ secrets.LOCALAZY_WRITE_KEY }} | ||
promote_from: 'latest' | ||
promote_to: 'production' |
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,18 @@ | ||
name: Upload to Localazy | ||
on: | ||
push: | ||
workflow_dispatch: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
localazy-upload: | ||
name: Upload strings to Localazy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: localazy/upload@v1 | ||
with: | ||
workdir: 'frontend' | ||
read_key: ${{ secrets.LOCALAZY_READ_KEY }} | ||
write_key: ${{ secrets.LOCALAZY_WRITE_KEY }} |
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,11 @@ | ||
{ | ||
"readKey": "read-key", | ||
"writeKey": "write-key", | ||
"upload": { | ||
"type": "json", | ||
"files": "translations/en.json" | ||
}, | ||
"download": { | ||
"files": "translations/${lang}.json" | ||
} | ||
} |
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
49 changes: 49 additions & 0 deletions
49
frontend/src/components/charts/conservation-chart/helpers.tsx
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,49 @@ | ||
/** | ||
* Render a multiline text in SVG | ||
* @param content String to render | ||
* @param maxLineCharacters Maximum number of characters per line | ||
*/ | ||
export const getMultilineRenderer = (content: string, maxLineCharacters: number) => { | ||
const MultiLinetext = ({ | ||
viewBox, | ||
offset, | ||
}: { | ||
viewBox: { x: number; y: number; width: number; height: number }; | ||
offset: number; | ||
}) => { | ||
const { x, y } = viewBox; | ||
|
||
const words = content.split(' '); | ||
const lines = []; | ||
let currentLine = ''; | ||
|
||
for (let i = 0, j = words.length; i < j; i++) { | ||
const word = words[i]; | ||
const potentialLine = currentLine.length > 0 ? `${currentLine} ${word}` : word; | ||
|
||
if (potentialLine.length <= maxLineCharacters) { | ||
currentLine = potentialLine; | ||
} else { | ||
// If `potentialLine.length === 0`, then `potentialLine === word` | ||
lines.push(currentLine.length > 0 ? currentLine : potentialLine); | ||
currentLine = word; | ||
} | ||
} | ||
|
||
if (currentLine.length > 0) { | ||
lines.push(currentLine); | ||
} | ||
|
||
return ( | ||
<text x={x + offset} y={y}> | ||
{lines.map((line) => ( | ||
<tspan key={line} x={x + offset} dy={15}> | ||
{line} | ||
</tspan> | ||
))} | ||
</text> | ||
); | ||
}; | ||
|
||
return MultiLinetext; | ||
}; |
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
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