use flags for game tiles

pull/205/head
Jon Eugster 2 years ago
parent ebda6cc162
commit 8b29f88407

@ -15,18 +15,10 @@ import {PrivacyPolicyPopup} from './popup/privacy_policy'
import { GameTile, useGetGameInfoQuery } from '../state/api' import { GameTile, useGetGameInfoQuery } from '../state/api'
import path from 'path'; import path from 'path';
import lean4gameConfig from '../config.json'
import { PreferencesPopup } from './popup/preferences'; import { PreferencesPopup } from './popup/preferences';
import { ImpressumButton, MenuButton, PreferencesButton } from './app_bar'; import { ImpressumButton, MenuButton, PreferencesButton } from './app_bar';
import ReactCountryFlag from 'react-country-flag';
const flag = { import lean4gameConfig from '../config.json'
'Dutch': '🇳🇱',
'English': '🇬🇧',
'French': '🇫🇷',
'German': '🇩🇪',
'Italian': '🇮🇹',
'Spanish': '🇪🇸',
}
function GithubIcon({url='https://github.com'}) { function GithubIcon({url='https://github.com'}) {
@ -74,7 +66,16 @@ function Tile({gameId, data}: {gameId: string, data: GameTile|undefined}) {
</tr> </tr>
<tr> <tr>
<td>{t("Language")}</td> <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> </tr>
</tbody> </tbody>
</table> </table>

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

Loading…
Cancel
Save