Giter Site home page Giter Site logo

Propose refactor about php-po-parser HOT 5 CLOSED

pherrymason avatar pherrymason commented on July 17, 2024
Propose refactor

from php-po-parser.

Comments (5)

pherrymason avatar pherrymason commented on July 17, 2024

I see this as an improvement some complex projects may benefit.
Some questions thouhg:

  • A writer that stores info in database, will write data in the same format as in a .po file?
  • If I understand correclty Parser will always expect a string as input previously supplied by the reeader.

from php-po-parser.

newage avatar newage commented on July 17, 2024
  1. Standard reader and writer can work with .po files.
    Extend reader/writer can work with DB. For example: fast search messages, translate with WHERE, create pagination for web UI. (For ExtJS UI). Or maybe use console translate-tool reader and writer.
  2. Yes, correctly about Parser

from php-po-parser.

pherrymason avatar pherrymason commented on July 17, 2024

While I see your point in extending the class to support database, I'm thinking in the following scenarios:

  1. Storing the whole .po file in a row inside a database. I see no point in supporting this by PoParser. While currently you can only parse files, there is a pull request that allows parsing a string. This will allow anyone parse any .po string format from any source.
  2. Designing a database schema to read and write msgid efficiently and do it transparent to the developer. While it is a good idea, I think this should belong to a whole new project by itself. The main purpose of PoParse is to be able to read easily a .po file/string and modify it. If msgid's are stored in a completely different way, then this is not the job of PoParse anymore.

I will recheck the pull request as I think there was some caveats still pending and we'll be able to parse any source string.

from php-po-parser.

newage avatar newage commented on July 17, 2024

I agree with you. Parser object must contains read and write methods. And read and write only .po files

from php-po-parser.

pherrymason avatar pherrymason commented on July 17, 2024

I've improved PoParser and now it has three new methods to parse PO data:

  • parseFile( filepath )
  • parseString( string )
  • parse( Handler )

Handler must be an object of a class implementing the InterfaceHandler so theoretically this could allow to implement a way of reading PO data file from any source.

from php-po-parser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.