Skip to content

Commit

Permalink
use flags for game tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
joneugster committed Mar 26, 2024
1 parent ebda6cc commit 8b29f88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
23 changes: 12 additions & 11 deletions client/src/components/landing_page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,10 @@ import {PrivacyPolicyPopup} from './popup/privacy_policy'
import { GameTile, useGetGameInfoQuery } from '../state/api'
import path from 'path';

import lean4gameConfig from '../config.json'
import { PreferencesPopup } from './popup/preferences';
import { ImpressumButton, MenuButton, PreferencesButton } from './app_bar';

const flag = {
'Dutch': '๐Ÿ‡ณ๐Ÿ‡ฑ',
'English': '๐Ÿ‡ฌ๐Ÿ‡ง',
'French': '๐Ÿ‡ซ๐Ÿ‡ท',
'German': '๐Ÿ‡ฉ๐Ÿ‡ช',
'Italian': '๐Ÿ‡ฎ๐Ÿ‡น',
'Spanish': '๐Ÿ‡ช๐Ÿ‡ธ',
}
import ReactCountryFlag from 'react-country-flag';
import lean4gameConfig from '../config.json'

function GithubIcon({url='https://github.com'}) {

Expand Down Expand Up @@ -74,7 +66,16 @@ function Tile({gameId, data}: {gameId: string, data: GameTile|undefined}) {
</tr>
<tr>
<td>{t("Language")}</td>
<td title={`in ${data.languages.join(', ')}`}>{data.languages.map((lan) => flag[lan]).join(', ')}</td>

<td>
{data.languages.map((lang) => {
let langOpt = lean4gameConfig.languages.find((e) => e.iso == lang)
if (langOpt) {
return <ReactCountryFlag title={langOpt.name} countryCode={langOpt.flag} className="emojiFlag"/>
} else
return <></>
})}
</td>
</tr>
</tbody>
</table>
Expand Down
5 changes: 3 additions & 2 deletions server/GameServer/Commands.lean
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ elab "CaptionLong" t:str : command => do
modifyCurGame fun game => pure {game with
tile := {game.tile with long := caption}}

/-- A list of Languages the game is translated to. For example `Languages "German" "English"`.
NOTE: For the time being, only a single language is supported.
/-- A list of Languages the game is translated to. For example `Languages "de" "en"`.
The keys are ISO language codes.
-/
elab "Languages" t:str* : command => do
modifyCurGame fun game => pure {game with
Expand Down

0 comments on commit 8b29f88

Please sign in to comment.