dtjkl42086 2016-07-08 17:33
浏览 16

网站内部化 - 最佳规则[已结束]

I'm using PHP.

I've a system that I need to translate in french, italian, spanish, ...

So I came with two solutions.

Solution 1: All the language strings are store in a DB to allow easy editing after for the administrator. So on each page I will need to call this table in order to get the correct strings.

Solution 2: Same like the first one except that I will generate after each change a Json file. This Json file will be call on each page to print the right strings.

Witch of my solution is the best pleas ?

Perhaps, another solution exists for that ?

Thanks.

  • 写回答

2条回答 默认 最新

  • doure5236 2016-07-08 17:44
    关注

    Use a database: you can hold questions and answers in a table that has each language answer in columns - its simple enough to then set up an RBAC module to allow specific users to add new questions and answers.

    questions_table:
        question_id (int) 255 PK AUTO_INCREMENT
        question (varchar) 160
    
    answers_table:
        answer_id (int) 255 PK AUTO_INCREMENT
        question_id (int) 255
        language_id (int) 255
        answer (varchar)
    
    language_table:
        language_id (int) 255 PK AUTO_INCREMENT
        language (varchar) 30
    
    user table and user answer table also
    

    using this, you'll be able to reference between tables using INNER JOIN sql statements, then all you need to do is create a driver object for your connection (preferably pdo) and then objects for answering questions, logging in, registering, admin and a front end display.

    评论

报告相同问题?

悬赏问题

  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计