Merge branch 'main' into web-layout

This commit is contained in:
Dan Abramov
2023-12-23 01:18:54 +00:00
8 changed files with 4971 additions and 6 deletions
+19 -5
View File
@@ -1,8 +1,10 @@
package main
import (
"encoding/xml"
"fmt"
"net/http"
"time"
appbsky "github.com/bluesky-social/indigo/api/bsky"
"github.com/bluesky-social/indigo/atproto/syntax"
@@ -10,6 +12,12 @@ import (
"github.com/labstack/echo/v4"
)
type ItemGUID struct {
XMLName xml.Name `xml:"guid"`
Value string `xml:",chardata"`
IsPerma bool `xml:"isPermaLink,attr"`
}
// We don't actually populate the title for "posts".
// Some background: https://book.micro.blog/rss-for-microblogs/
type Item struct {
@@ -17,8 +25,7 @@ type Item struct {
Link string `xml:"link,omitempty"`
Description string `xml:"description,omitempty"`
PubDate string `xml:"pubDate,omitempty"`
Author string `xml:"author,omitempty"`
GUID string `xml:"guid,omitempty"`
GUID ItemGUID
}
type rss struct {
@@ -71,12 +78,19 @@ func (srv *Server) WebProfileRSS(c echo.Context) error {
if rec.Reply != nil {
continue
}
pubDate := ""
createdAt, err := syntax.ParseDatetimeLenient(rec.CreatedAt)
if nil == err {
pubDate = createdAt.Time().Format(time.RFC822Z)
}
posts = append(posts, Item{
Link: fmt.Sprintf("https://bsky.app/profile/%s/post/%s", pv.Handle, aturi.RecordKey().String()),
Description: rec.Text,
PubDate: rec.CreatedAt,
Author: "@" + pv.Handle,
GUID: aturi.String(),
PubDate: pubDate,
GUID: ItemGUID{
Value: aturi.String(),
IsPerma: false,
},
})
}
+1 -1
View File
@@ -1,6 +1,6 @@
/** @type {import('@lingui/conf').LinguiConfig} */
module.exports = {
locales: ['en', 'hi', 'ja', 'fr'],
locales: ['en', 'hi', 'ja', 'fr', 'de', 'es'],
catalogs: [
{
path: '<rootDir>/src/locale/locales/{locale}/messages',
+4
View File
@@ -116,6 +116,10 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage {
return AppLanguage.ja
case 'fr':
return AppLanguage.fr
case 'de':
return AppLanguage.de
case 'es':
return AppLanguage.es
default:
continue
}
+11
View File
@@ -6,6 +6,9 @@ import {messages as messagesEn} from '#/locale/locales/en/messages'
import {messages as messagesHi} from '#/locale/locales/hi/messages'
import {messages as messagesJa} from '#/locale/locales/ja/messages'
import {messages as messagesFr} from '#/locale/locales/fr/messages'
import {messages as messagesDe} from '#/locale/locales/de/messages'
import {messages as messagesEs} from '#/locale/locales/de/messages'
import {sanitizeAppLanguageSetting} from '#/locale/helpers'
import {AppLanguage} from '#/locale/languages'
@@ -26,6 +29,14 @@ export async function dynamicActivate(locale: AppLanguage) {
i18n.loadAndActivate({locale, messages: messagesFr})
break
}
case AppLanguage.de: {
i18n.loadAndActivate({locale, messages: messagesDe})
break
}
case AppLanguage.es: {
i18n.loadAndActivate({locale, messages: messagesEs})
break
}
default: {
i18n.loadAndActivate({locale, messages: messagesEn})
break
+8
View File
@@ -24,6 +24,14 @@ export async function dynamicActivate(locale: AppLanguage) {
mod = await import(`./locales/fr/messages`)
break
}
case AppLanguage.de: {
mod = await import(`./locales/de/messages`)
break
}
case AppLanguage.es: {
mod = await import(`./locales/es/messages`)
break
}
default: {
mod = await import(`./locales/en/messages`)
break
+4
View File
@@ -9,6 +9,8 @@ export enum AppLanguage {
hi = 'hi',
ja = 'ja',
fr = 'fr',
de = 'de',
es = 'es',
}
interface AppLanguageConfig {
@@ -21,6 +23,8 @@ export const APP_LANGUAGES: AppLanguageConfig[] = [
{code2: AppLanguage.hi, name: 'हिंदी'},
{code2: AppLanguage.ja, name: '日本語'},
{code2: AppLanguage.fr, name: 'Français'},
{code2: AppLanguage.de, name: 'Deutsch'},
{code2: AppLanguage.es, name: 'Español'},
]
export const LANGUAGES: Language[] = [
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff