add nuxt localization

This commit is contained in:
hay-kot committed 2021-08-07 11:28:20 -08:00
1 parent 695d7e96ae
commit c13fb6743c
3 files changed
+116 -5

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
from pathlib import Path
from pprint import pprint
PROJECT_DIR = Path(__file__).parent.parent.parent
datetime_dir = PROJECT_DIR / "frontend" / "lang" / "dateTimeFormats"
locales_dir = PROJECT_DIR / "datetime" / "lang" / "messages"
"""
{
code: "en-US",
file: "en-US.json",
}
"en-US": require("./lang/dateTimeFormats/en-US.json"),
"""
def main():
print("Starting...")
all_langs = []
for match in datetime_dir.glob("*.json"):
print(f'"{match.stem}": require("./lang/dateTimeFormats/{match.name}"),')
all_langs.append({"code": match.stem, "file": match.name})
print("\n\n\n--------- All Languages -----------")
pprint(all_langs)
print("Finished...")
if __name__ == "__main__":
main()
-1
View File
@@ -1 +0,0 @@
{"openapi": "3.0.2", "info": {"title": "Mealie", "description": "A place for all your recipes", "version": "v0.5.2"}, "paths": {"/api/auth/token": {"post": {"tags": ["Authentication"], "summary": "Get Token", "operationId": "get_token_api_auth_token_post", "requestBody": {"content": {"application/x-www-form-urlencoded": {"schema": {"$ref": "#/components/schemas/Body_get_token_api_auth_token_post"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/auth/token/long": {"post": {"tags": ["Authentication"], "summary": "Get Token", "operationId": "get_token_api_auth_token_long_post", "requestBody": {"content": {"application/x-www-form-urlencoded": {"schema": {"$ref": "#/components/schemas/Body_get_token_api_auth_token_long_post"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/auth/refresh": {"get": {"tags": ["Authentication"], "summary": "Refresh Token", "description": "Use a valid token to get another token", "operationId": "refresh_token_api_auth_refresh_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/api/users/sign-ups/{token}": {"post": {"tags": ["User Signup"], "summary": "Create User With Token", "description": "Creates a user with a valid sign up token ", "operationId": "create_user_with_token_api_users_sign_ups__token__post", "parameters": [{"required": true, "schema": {"title": "Token", "type": "string"}, "name": "token", "in": "path"}], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/UserIn"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"tags": ["User Signup"], "summary": "Delete Token", "description": "Removed a token from the database ", "operationId": "delete_token_api_users_sign_ups__token__delete", "parameters": [{"required": true, "schema": {"title": "Token", "type": "string"}, "name": "token", "in": "path"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/api/users/sign-ups": {"get": {"tags": ["User Signup"], "summary": "Get All Open Sign Ups", "description": "Returns a list of open sign up links ", "operationId": "get_all_open_sign_ups_api_users_sign_ups_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"title": "Response Get All Open Sign Ups Api Users Sign Ups Get", "type": "array", "items": {"$ref": "#/components/schemas/SignUpOut"}}}}}}, "security": [{"OAuth2PasswordBearer": []}]}, "post": {"tags": ["User Signup"], "summary": "Create User Sign Up Key", "description": "Generates a Random Token that a new user can sign up with ", "operationId": "create_user_sign_up_key_api_users_sign_ups_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/SignUpIn"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SignUpToken"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"OAuth2PasswordBearer": []}]}}, "/api/users/{id}/image": {"get": {"tags": ["Users"], "summary": "Get User Image", "description": "Returns a users profile picture ", "operationId": "get_user_image_api_users__id__image_get", "parameters": [{"required": true, "schema": {"title": "Id", "type": "string"}, "name": "id", "in": "path"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "post": {"tags": ["Users"], "summary": "Update User Image", "description": "Updates a User Image ", "operationId": "update_user_image_api_users__id__image_post", "parameters": [{"required": true, "schema": {"title": "Id", "type": "string"}, "name": "id", "in": "path"}], "requestBody": {"content": {"multipart/form-data": {"schema": {"$ref"Line truncated
+78 -4
View File
@@ -107,14 +107,79 @@ export default {
i18n: {
locales: [
{
code: "en-US",
file: "en-US.js",
},
// Auto Generated from "generate_nuxt_locales.py"
{ code: "el-GR", file: "el-GR.json" },
{ code: "it-IT", file: "it-IT.json" },
{ code: "ko-KR", file: "ko-KR.json" },
{ code: "es-ES", file: "es-ES.json" },
{ code: "ja-JP", file: "ja-JP.json" },
{ code: "zh-CN", file: "zh-CN.json" },
{ code: "tr-TR", file: "tr-TR.json" },
{ code: "ar-SA", file: "ar-SA.json" },
{ code: "hu-HU", file: "hu-HU.json" },
{ code: "pt-PT", file: "pt-PT.json" },
{ code: "no-NO", file: "no-NO.json" },
{ code: "sv-SE", file: "sv-SE.json" },
{ code: "ro-RO", file: "ro-RO.json" },
{ code: "uk-UA", file: "uk-UA.json" },
{ code: "pl-PL", file: "pl-PL.json" },
{ code: "da-DK", file: "da-DK.json" },
{ code: "pt-BR", file: "pt-BR.json" },
{ code: "de-DE", file: "de-DE.json" },
{ code: "ca-ES", file: "ca-ES.json" },
{ code: "sr-SP", file: "sr-SP.json" },
{ code: "cs-CZ", file: "cs-CZ.json" },
{ code: "fr-FR", file: "fr-FR.json" },
{ code: "zh-TW", file: "zh-TW.json" },
{ code: "af-ZA", file: "af-ZA.json" },
{ code: "ru-RU", file: "ru-RU.json" },
{ code: "he-IL", file: "he-IL.json" },
{ code: "nl-NL", file: "nl-NL.json" },
{ code: "en-US", file: "en-US.json" },
{ code: "en-GB", file: "en-GB.json" },
{ code: "fi-FI", file: "fi-FI.json" },
{ code: "vi-VN", file: "vi-VN.json" },
],
lazy: true,
langDir: "lang/messages",
defaultLocale: "en-US",
vueI18n: {
dateTimeFormats: {
// Auto Generated from "generate_nuxt_locales.py"
"el-GR": require("./lang/dateTimeFormats/el-GR.json"),
"it-IT": require("./lang/dateTimeFormats/it-IT.json"),
"ko-KR": require("./lang/dateTimeFormats/ko-KR.json"),
"es-ES": require("./lang/dateTimeFormats/es-ES.json"),
"ja-JP": require("./lang/dateTimeFormats/ja-JP.json"),
"zh-CN": require("./lang/dateTimeFormats/zh-CN.json"),
"tr-TR": require("./lang/dateTimeFormats/tr-TR.json"),
"ar-SA": require("./lang/dateTimeFormats/ar-SA.json"),
"hu-HU": require("./lang/dateTimeFormats/hu-HU.json"),
"pt-PT": require("./lang/dateTimeFormats/pt-PT.json"),
"no-NO": require("./lang/dateTimeFormats/no-NO.json"),
"sv-SE": require("./lang/dateTimeFormats/sv-SE.json"),
"ro-RO": require("./lang/dateTimeFormats/ro-RO.json"),
"uk-UA": require("./lang/dateTimeFormats/uk-UA.json"),
"pl-PL": require("./lang/dateTimeFormats/pl-PL.json"),
"da-DK": require("./lang/dateTimeFormats/da-DK.json"),
"pt-BR": require("./lang/dateTimeFormats/pt-BR.json"),
"de-DE": require("./lang/dateTimeFormats/de-DE.json"),
"ca-ES": require("./lang/dateTimeFormats/ca-ES.json"),
"sr-SP": require("./lang/dateTimeFormats/sr-SP.json"),
"cs-CZ": require("./lang/dateTimeFormats/cs-CZ.json"),
"fr-FR": require("./lang/dateTimeFormats/fr-FR.json"),
"zh-TW": require("./lang/dateTimeFormats/zh-TW.json"),
"af-ZA": require("./lang/dateTimeFormats/af-ZA.json"),
"ru-RU": require("./lang/dateTimeFormats/ru-RU.json"),
"he-IL": require("./lang/dateTimeFormats/he-IL.json"),
"nl-NL": require("./lang/dateTimeFormats/nl-NL.json"),
"en-US": require("./lang/dateTimeFormats/en-US.json"),
"en-GB": require("./lang/dateTimeFormats/en-GB.json"),
"fi-FI": require("./lang/dateTimeFormats/fi-FI.json"),
"vi-VN": require("./lang/dateTimeFormats/vi-VN.json"),
},
},
fallbackLocale: "es",
},
// Axios module configuration: https://go.nuxtjs.dev/config-axios
@@ -130,6 +195,15 @@ export default {
// Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify
vuetify: {
customVariables: ["~/assets/variables.scss"],
icons: {
iconfont: "mdiSvg", // 'mdi' || 'mdiSvg' || 'md' || 'fa' || 'fa4' || 'faSvg'
},
defaultAssets: {
font: {
family: "Roboto",
},
icons: false,
},
theme: {
dark: false,
themes: {