【problem analysis】Error: “app_name” is not translated in af

本文详细介绍了在使用AndroidTools进行应用签名时遇到本地化问题的解决方法,包括修改本地化设置和调整Lint错误提示。通过将关键字符串设置为无需翻译或调整错误提示严重级别,开发者可以避免在应用发布前遇到不必要的障碍。


为了生成应用签名,使用Android Tools>Export Signed Application Package

提示了错误:

"app_name" is not translated in af, am, ar, be, bg, ca, cs, da, de, el, en-rGB, en-rIN, es, es-rUS, et, et-rEE, fa, fi, fr, fr-rCA, hi, hr, hu, hy-rAM, in, it, iw, ja, ka-rGE, km-rKH, ko, lo-rLA, lt, lv, mn-rMN, ms, ms-rMY, nb, nl, pl, pt, pt-rBR, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rHK, zh-rTW, zu

原因:

资源文件本地化问题

解决一:不需要本地化 设置为 不需要翻译 translatable="false"

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name" translatable="false">考神</string>
    <string name="hello_world" translatable="false">Hello world!</string>

</resources>

解决二:设置lint的错误提示

In your ADT go to window->Preferences->Android->Lint Error Checking

Find there Missing Translation and change its Severity to Warning.

"Window" > "Preferences" > "Android" > "Lint Error Checking"

You should be able to disable

"Run full error check when exporting app and abort if fatal errors are found".



import os import datetime from fastapi import FastAPI, UploadFile, File, Request from fastapi.responses import HTMLResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates from transformers import AutoModelForCausalLM, AutoTokenizer from utils.web_searcher import search_with_bocha from utils.file_processor import process_uploaded_file import torch # 初始化FastAPI app = FastAPI() app.mount("/static", StaticFiles(directory="static"), name="static") templates = Jinja2Templates(directory="templates") # 加载模型 model_path = "D:/Qwen2.5/models/qwen/Qwen1.5-7B-Chat" device = "cuda" if torch.cuda.is_available() else "cpu" # 量化配置以节省显存 load_kwargs = { "torch_dtype": torch.float16, "device_map": "auto" } tokenizer = AutoTokenizer.from_pretrained(model_path) model = AutoModelForCausalLM.from_pretrained(model_path, **load_kwargs,load_in_8bit=True) def get_current_time(): """获取当前本地时间""" return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") def generate_response(prompt, search_results=None): """生成AI响应""" current_time = get_current_time() # 构建系统提示 system_prompt = f"""你是一个智能助手,当前时间是{current_time}。 你具备翻译功能,当用户要求翻译时,你需要提供高质量的翻译结果。 """ if search_results: system_prompt += f"\n以下是网络搜索结果:\n{search_results}\n请基于这些信息回答。" messages = [ {"role": "system", "content": system_prompt}, {"role": "user", "content": prompt} ] inputs = tokenizer.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_tensors="pt" ).to(device) outputs = model.generate( inputs, max_new_tokens=512, do_sample=True, temperature=0.7, top_p=0.9 ) response = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True) return response @app.get("/", response_class=HTMLResponse) async def chat_interface(request: Request): return templates.TemplateResponse("chat.html", {"request": request}) @app.post("/chat") async def chat_endpoint(request: Request): form_data = await request.form() user_input = form_data.get("message", "") use_search = form_data.get("use_search", False) search_results = None if use_search: search_results = search_with_bocha(user_input) response = generate_response(user_input, search_results) return {"response": response} @app.post("/upload") async def upload_file(file: UploadFile = File(...)): file_path = f"data/uploads/{file.filename}" with open(file_path, "wb") as f: f.write(await file.read()) translated_content = process_uploaded_file(file_path) return {"filename": file.filename, "translated_content": translated_content} if __name__ == "__main__": import uvicorn uvicorn.run(app, host="0.0.0.0", port=8000)
10-11
### 图形变换中 Translation、Rotation、Scaling、Skew 和 Aspect 的具体含义和作用 #### 1. Translation(平移) 平移是一种将图形从一个位置移动到另一个位置的变换操作。在二维坐标系中,平移可以通过改变每个点的 x 和 y 坐标来实现。平移的数学表达式为: ```python x' = x + tx y' = y + ty ``` 其中,`tx` 和 `ty` 分别是沿 x 轴和 y 轴的平移量[^1]。平移不会改变图形的形状或大小,仅改变其位置。 #### 2. Rotation(旋转) 旋转是一种围绕某个固定点将图形旋转一定角度的变换操作。旋转的角度通常以弧度或度数表示。在二维坐标系中,围绕原点的旋转公式为: ```python x' = x * cos(θ) - y * sin(θ) y' = x * sin(θ) + y * cos(θ) ``` 其中,`θ` 是旋转角度。如果需要围绕非原点的点 `(cx, cy)` 进行旋转,则需要先将图形平移到原点,执行旋转后,再平移回原始位置[^2]。 #### 3. Scaling(缩放) 缩放是一种改变图形大小的变换操作。在二维坐标系中,缩放可以通过调整每个点的 x 和 y 坐标的比例因子来实现。缩放的数学表达式为: ```python x' = x * sx y' = y * sy ``` 其中,`sx` 和 `sy` 分别是沿 x 轴和 y 轴的缩放因子。当 `sx = sy` 时,图形会均匀缩放;否则,图形会发生拉伸或压缩[^3]。 #### 4. Skew(倾斜) 倾斜是一种通过改变图形的角度关系来创建斜面效果的变换操作。倾斜可以分为 x 方向倾斜和 y 方向倾斜。倾斜的数学表达式为: ```python x' = x + y * tan(α) y' = y ``` 对于 x 方向倾斜,`α` 是倾斜角度;对于 y 方向倾斜,公式类似但交换了 x 和 y 的角色。倾斜会导致图形的平行线不再保持平行[^4]。 #### 5. Aspect(宽高比) 宽高比是指图形的宽度与高度之间的比例关系。在图形变换中,宽高比通常用于确保图形在缩放或变形时保持视觉上的协调性。例如,在图像处理中,保持宽高比意味着在调整图像大小时,宽度和高度的变化比例相同,以避免图像变形失真[^5]。 ### 示例代码 以下是一个使用 Python 和 NumPy 实现基本图形变换的示例: ```python import numpy as np # 定义初始点 points = np.array([[0, 0], [1, 0], [1, 1], [0, 1]]) # 平移 def translate(points, tx, ty): return points + np.array([tx, ty]) # 旋转 def rotate(points, theta): rotation_matrix = np.array([ [np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)] ]) return np.dot(points, rotation_matrix.T) # 缩放 def scale(points, sx, sy): return points * np.array([sx, sy]) # 倾斜 def skew(points, alpha_x, alpha_y): skew_matrix = np.array([ [1, np.tan(alpha_x)], [np.tan(alpha_y), 1] ]) return np.dot(points, skew_matrix.T) # 示例:对点进行一系列变换 translated_points = translate(points, 2, 3) rotated_points = rotate(translated_points, np.pi / 4) scaled_points = scale(rotated_points, 2, 1.5) skewed_points = skew(scaled_points, np.pi / 6, 0) print(skewed_points) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值