TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How do you manage text in software projects?

4 点作者 jonasvp大约 5 年前
Dealing with text in software or web projects is always a mess: the customer needs a process for changing and approving content, labels, button descriptions, etc. and we always end up implementing some sort of custom process in Trello, Jira, et.al. The result does not integrate well with the code tools we have.<p>PO files work well for software but don&#x27;t really interface with customers and approval processes. Adding localisation into the mix makes it even more demanding - now we have to keep track if the original text changes so the translations get updated.<p>How do you solve this?

1 comment

sandreas大约 5 年前
In my opinion this totally depends on the use case. I came across the following rules for my smaller projects (caution: strongly opinionated):<p><pre><code> - Use a simple key&#x2F;value structure (you won&#x27;t need categories&#x2F;lazy loading, until your app is REALLY big),e.g. {&quot;placeholder&quot;: &quot;translation&quot;} in JS - Use unified access to this structure (Aspect oriented&#x2F;Service registry&#x2F;simple function) with a default language fallback - e.g. a function translate(&#x27;myTranslation&#x27;); - If possible, use a very fast but simple key&#x2F;value data structure (dictionary, array, object, whatever) to store the default translations (static&#x2F;compile time!) - Don&#x27;t try to find automatic solutions for pluralization (just store another key&#x2F;value pair for the plural[s]) - If you need to switch translations at runtime or update translations on a regular basis (e.g. after updating translations from a db) use a fast, cacheable proxy in front of your key&#x2F;value thing - Create a language &quot;placeholders&quot;, to see the placeholders used directly in the app just by switching to it - Don&#x27;t use constants (because it might be possible that you need to load two languages at a time) </code></pre> Just my 2 cents